Reputation: 6686
In every document i have some field (for example "myfield"). myfield is value of type int32.
Please show me (with tiny code example) how to make query like:
"get all where myfield > 10 and myfield < 20"
I am using an official C# driver.
Thank you very much!!!
Upvotes: 1
Views: 12580
Reputation: 105
With criteria is
Expression<Func<T, bool>> criteria;
You can use this:
collection.Remove(Query<T>.Where(criteria));
Upvotes: 0
Reputation: 53695
Following code example search for documents in 'someDb' in 'someCollection' where myfield > 10 and < 20 :
var server = MongoServer.Create("mongodb://localhost:27020");
var database = server.GetDatabase("someDb");
var collection = database.GetCollection<Type>("someCollection");
var searchQuery = Query.GT("myfield", 10).LT(20);
var list = collection.Find(searchQuery);
But be sure that you have run mongodb on 27020 port.
Upvotes: 14