Skip to content

Instantly share code, notes, and snippets.

@mattpodwysocki
Created October 26, 2009 02:25
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mattpodwysocki/218388 to your computer and use it in GitHub Desktop.
Save mattpodwysocki/218388 to your computer and use it in GitHub Desktop.
#if INTERACTIVE
#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"
#endif
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