Home > database >  Mongo just beginning to understand the query about the time is very confused
Mongo just beginning to understand the query about the time is very confused

Time:09-15

Queries about mongo time
Database is as shown in the record


But I do not check through the following query why?
The getCollection (' company_tag). Find ({" modify_time ": {" $gte" : "the 2019-10-14 17:27:29"}});


But with the following, have which bosses can explain in detail?
The getCollection (' company_tag). Find ({" modify_time ": {" $gte" : ISODate (" the 2019-10-14 17:27:29 ")}});

CodePudding user response:

O solve the SSSSS

CodePudding user response:

Check the first kind is the string, the second is the standard ISO time,
Proposed that a unified into ISO time to store and query, string in time is not very convenient, each client, the server time zone is not unified, this time a string is chaos,

CodePudding user response:

Mongo on the data type is very strict, not date, other types also have this kind of problem, such as the following, the deposit is digital, not to be found with string
The db. The test. The insert ({a: 100})
The db. The test. The find ({a: '100'})
The db. The test. The find ({a: 100})

CodePudding user response:

Add one this ISODate
  • Related