The data structure to query is as follows:
As an example of querying the Versionlimitlist field
Mongooperations Tool class Query related statements
<pre name= "code" class= "java" >criteria criteria1 = Criteria.where ("Validstarttime"). GT (New Date ()). and (" Versionlimitlist "). Elemmatch (Criteria.where (" ClientId "). Is (109), and (" Platformcode "). is (2);
Enquiry
validstarttime is greater than the current time, and the clientId in the Versionlimitlist field The property value is 109 and the Platformcode property value is 2
Statements in the Mongovue
{" validstarttime": { "$gt": Isodate ("2014-11-01t10:33:09.661z") }, "Versionlimitlist": { "$ Elemmatch ": { " clientId ": 109, " Platformcode ": 2}} }
Corresponds to the actual executed statement
Db.systemInfo211.find ({"Validstarttime": {"$gt": Isodate ("2014-11-01t10:33:09.661z")}, "Versionlimitlist": {"$elem Match ": {" clientId ": 109," Platformcode ": 2}}). Limit (50);
The query results are as follows
A query in MongoDB that contains a field in a collection in a query condition