MongoDB Java Driver: Aggregation using $match with multiple condition -


i've been doing search haven't been able find answer. docs, in mongo, if

$match: { type: "airfare"} 

translated as:

dbobject match = new basicdbobject("$match", new basicdbobject("type", "airfare") ); 

in mongo java driver, how translate 1 mongo java driver?

$match : { score : { $gt : 70, $lte : 90 } } 

edit

this wanted do:

$match : { bookingdatetime: { $gte : fromdate, $lte : todate } } 

and how implemented in mongodb java driver, no luck far:

dbobject matchfields2 = new basicdbobject("$match", new basicdbobject("bookingdatetime", new basicdbobject("$gte", fromdate.gettime()).append("$lte", todate.gettime()))); dbobject match2 = new basicdbobject("$match", matchfields2); 

fromdate calendar object hence gettime() method convert calendar class date class.

object match = new basicdbobject("$match",     new basicdbobject("score",    new basicdbobject("$gt", 70).append("$lte", 90) ) ) 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -