The mongo java driver takes var args for aggregate method, I have an API in which $unwind
objects get's created dynamically and its number is not fixed. how can I pass it through Mongo Java driver aggregate method, as it needs each object to be passed separately. I tried passing putting all the $unwind
object in a BasicDBList and pass, but it fails. Can someone help me with some work around?
example:
db.foo.aggregate({$unwind:items},{$unwind:item2})
, but these unwind may vary as it is getting created at runtime.