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!!!
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.