Created
April 6, 2021 14:08
-
-
Save brianberns/1f8799f661c70b5013fd11ce9ac9bee5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open MongoDB.Bson | |
open MongoDB.Driver | |
type User = | |
{ | |
_id : BsonObjectId | |
Name : string | |
} | |
[<EntryPoint>] | |
let main argv = | |
let client = MongoClient("mongodb://localhost:27017") | |
let db = client.GetDatabase("test") | |
let coll = db.GetCollection<User>("User") | |
let filter = | |
Builders<User> | |
.Filter | |
.Regex( | |
(fun user -> user.Name :> obj), | |
BsonRegularExpression("o")) | |
for entry in coll.Find(filter).ToEnumerable() do | |
printfn "%A" entry | |
0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment