devbliss/mongojack — pull request #29 by rmalchow (2013-11-29 04:31:53+00:00)
Title: with "IN", things get a bit more complicated

hi,

so - i was having issues with doing $in. $in works both ways, so with this:

public class A {
private List names;
}

and instances with

a --> names = ["x", "y", "z"]
b --> names = ["x"]

i can do:

{ "names" : {"$in" : ["x",y"] }}

which would return both. however, weirdly, the serializer returned for names is a serializer for STRING, not for a collection of strings (so maybe that, in itself, is wrong, note the value "false" for "targetIsCollection").

anyway. the thing is that we cannot infere the type of the value from the type of the field. both sides MAY or MAY NOT be collections. the values that are actually possible also depend on the operator.

this is kind of a quick fix (it solved my problem with "$in" queries). maybe we can improve on this?