Skip to content

Instantly share code, notes, and snippets.

@atheken
Created July 11, 2010 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atheken/471585 to your computer and use it in GitHub Desktop.
Save atheken/471585 to your computer and use it in GitHub Desktop.
using (var db = Mongo.Create ("mongodb://localhost/testdb"))
{
var posts = db.GetCollection<Post> ();
//you can just put a lambda expression in for the fields that you want indexed.
posts.CreateIndex (j => new { j.Body, j.Title },
"Compound_Post_Index",true,IndexOption.Ascending);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment