Get a list of documents from Mongo DB
- by Andrei Neagu
Hello,
I want to do something like this:
List<int> fff = new List<int>();
fff.Add(1);
fff.Add(2);
fff.Add(5);
Mongo m = new Mongo();
m.Connect();
var dataBase = m.GetDatabase("database");
var collection = dataBase.GetCollection("coll");
IMongoQuery queryable = collection.AsQueryable();
MongoQueryProvider prov = new MongoQueryProvider(collection);
var query = new MongoQuery(prov);
var ffppp = from p221 in query where fff.Contains((int)p221["oid"]) select p221;
This throws this error : The method 'Contains' could not be converted into a constant.
I saw that mongo has an operator $in. Does any one know how can I use it from c#? (http://www.mongodb.org/display/DOCS/Advanced+Queries)
Thanks