Several important points to keep in mind:
- All dates are stored in UTC in MongoDB
- MongoDB stores dates internally as a 64 bit integer representing
milliseconds since 1970-01-01T00:00:00Z
- If the date value you provide the C# driver is not already in UTC it
will be converted to UTC before being stored in MongoDB
- There is no actual data type called ISODate, that is just the way
the shell displays dates (in more recent versions anyway)
- Before ISODate was introduced dates were displayed as { $date :
somereallybigintegerthatmeansnothingtohumas }
- In the latest versions of the C# driver (but post v1.0) ToJson now
also uses the new ISODate display format
I see in your first posting that you are using DateTime.Now, so the
value is going to be converted to UTC as it is stored in the database.
Consider using DateTime.UtcNow.
For the question in your second post, I recommend not using
DateTime.Parse. You get into all sorts of issues with time zones and
cultural conventions regarding how DateTimes are formatted. Instead
just use the DateTime constructors, being careful to use UTC or else
to carefully take timezone conversions into account. I would write
your query as:
var beginTime = new DateTime(2011, 4, 26, 0, 0, 0, DateTimeKind.Utc);
var query = Query.GTE("start", beginTime);
but you also have to make sure you used UTC when you inserted the
documents.
If you still have problems you could provide a sample document as
output by the mongo shell and also let us know what timezone you are
in.