Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#I @"C:\Tools\MongoDB-CSharp\MongoDB.Linq\bin\Debug"
#r "MongoDB.Driver.dll"
#r "MongoDB.Linq.dll"
#r "FSharp.PowerPack.Linq.dll"
#r "System.Core.dll"
open System
open MongoDB.Driver
open MongoDB.Linq
open Microsoft.FSharp.Linq.Query
open System.Linq
let mongo = new Mongo()
let connected = mongo.Connect()
let db = mongo.["movieDB"]
db.["movies"].Insert((new Document()).Append("title", "Star Wars").Append("releaseDate", DateTime.Now))
let movies = db.["movies"].AsQueryable() :> IQueryable<Document>
let titles =
query <@ seq { for movie in movies do
yield movie } @>
let disconnected = mongo.Disconnect()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment