Skip to content

Instantly share code, notes, and snippets.

@visemet
visemet / example.fs
Last active August 29, 2015 14:23
Using the 2.0 .NET driver from F#
open MongoDB.Bson
open MongoDB.Driver
open FSharp.Control
let query filter =
let client = MongoClient()
let db = client.GetDatabase "test"
let coll = db.GetCollection<BsonDocument> "widgets"
asyncSeq {

Keybase proof

I hereby claim:

  • I am visemet on github.
  • I am visemet (https://keybase.io/visemet) on keybase.
  • I have a public key whose fingerprint is 6769 0D59 27B5 CCEA B931 6B10 DED0 F6CB 61B6 842D

To claim this, I am signing this object:

Enhancing the F# developer experience when using MongoDB

This is a guest post by Max Hirschhorn, who is currently an intern at 10gen.

About the F# programming language

F# is a multi-paradigm language built on the .NET framework. It is

@visemet
visemet / code-quotes-spec.md
Created July 26, 2013 22:32
Defines the structure for the various query and update operators that are supported by MongoDB in a way that is natural to use from F#. Note that the (?) operator is only necessary for dealing with an unknown schema, rather than a user-defined class in which case (.) would provide type safety. The code quotation is traversed to construct the cor…

Intend to support all selectors and operators listed here in one form or another.

let (?) (doc : BsonDocument) (field : string) =
    unbox doc.[field]

let (?<-) (doc : BsonDocument) (field : string) value =
    doc.[field] = unbox value |> ignore