Your sample code is not like it using the official C # driver.
Using the official C # driver, you should write something like:
var collection = database.GetCollection<FileLog>("logs"); var query = Query.EQ("CreatedOn", dateTimePicker1.Value.Date.ToUniversalTime()); foreach (var document in collection.FindAll(query)) {
You also need to make sure that you save the CreateOn values ββas real BSON DateTime values, not as strings.
You also need to keep in mind that DateTime values ββare stored in UTC with a resolution in milliseconds.
source share