The query conditions in MongoDB include fields in the collection.
The data structure to be queried is as follows:
Take the versionLimitList field as an example.
MongoOperations tool-related query 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);
Query
ValidStartTime is later than the current time, And the clientId attribute value in the versionLimitList field is 109 and the platFormCode attribute value is 2
Statement in explain vue
{ "validStartTime": { "$gt": ISODate("2014-11-01T10:33:09.661Z") }, "versionLimitList": { "$elemMatch": { "clientId": 109, "platFormCode": 2 } }}
Corresponding to the actually executed statement
db.systemInfo211.find({ "validStartTime" : { "$gt" : ISODate("2014-11-01T10:33:09.661Z") }, "versionLimitList" : { "$elemMatch" : { "clientId" : 109, "platFormCode" : 2 } } }).limit(50);
The query result is as follows: