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

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -