Criteria c1= Criteria.where ("year"). GTE (StartYear). LTE (Endyear). and ("month"). are (Endmonth). and ("Day"). GTE ( StartDay). LTE (Endday). and
("Hour"). GTE (Starthour). LTE (Endhour). is (minute). and ("Startminute") . GTE (Startsecond);
Criteria C2=criteria.where ("year"). GTE (StartYear). LTE (Endyear). and ("month"). are (Endmonth). and ("Day"). GTE ( StartDay). LTE (Endday). and
("Hour"). GTE (Starthour). LTE (Endhour). is (minute). and ("Endminute"). LTE (Endsecond);
Criteria C3 =criteria.where ("Year"). GTE (StartYear). LTE (Endyear). and ("month"). are (Endmonth). and ("Day"). GTE ( StartDay). LTE (Endday). and
("Hour"). GTE (Starthour). LTE (Endhour). and (minute). GT (Startminute). LT (Endminute) ;
Criteria CR = new criteria ();
query = new query (Cr.oroperator (C1,C2,C3));
Getmongotemplate (). Find (query, sensorcollection.class);
Attached to the criteria method:
Criteria
|
Mongodb |
Description |
Criteria and (String key) |
$and |
And |
Criteria Andoperator (Criteria ... criteria) |
$and |
And |
Criteria Oroperator (Criteria ... criteria) |
$or |
Or |
Criteria gt (Object o) |
$gt |
Greater than |
Criteria GTE (Object o) |
$gte |
Greater than or equal to |
Criteria in (Object ... o) |
$in |
Contains |
The Criteria is (Object o) |
$is |
Equals |
Criteria LT (Object o) |
$lt |
Less than |
Criteria LTE (Object o) |
$lte |
Small equals |
Criteria nin (Object ... o) |
$nin |
does not contain |
|