Mongodb : Why convert string date to ISOdate if comparison operators work?
问题 I have the following kind of document: { "_id" : ObjectId("538d64a11ca6e50941fda4d9"), "_id" : "538d518e20b8fd642e0000e8", "posts" : "some stuff", "date" : "2014-06-02" } Using comparison operators for a string date (Not the Mongodb ISODate) works: > collection.find({"date": {"$gte": "2014-06-02"}}) So why shall we (bother to) convert string dates to an ISODate then? 回答1: Probably the biggest advantage of using the MongoDB BSON Date type instead of a string is that you can only use the