vznet/mongo-jackson-mapper — Issue #4: Bad method overloading in DBQuery can result in faulty query objects
Author: pmaedel
Created: 2011-12-25 18:45:45+00:00
State: open

In DBQuery, a couple of methods are implemented as overloading methods, requiring either varargs (Object...) or a Collection as parameter. Due to precedence in JVM, each call to these methods with a Collection as a parameter will end up in the varargs method and finally result in a faulty query (object).

Example:
```List stringList = new ArrayList();
stringList.add("s1");
stringList.add("s2");
col.find(DBQuery.in("stringList", stringList)); //Ends up here: in(String field, Object... values)
```
Query Object generated:
```{stringList : { $in : [ [s1, s2] ] } }
```