@Test public void testGetMultiRoots() throws InvalidParseOperationException { final SelectParserMultiple request = new SelectParserMultiple(); request.parse(multiRootsJson); final SelectMultiQuery select = request.getRequest(); final Bson bsonRoot = QueryToMongodb.getRoots("_up", select.getRoots()); assertEquals("{\"_up\": {\"$in\": [\"id0\", \"id1\"]}}", MongoDbHelper.bsonToString(bsonRoot, false)); }
public static Bson getRoots(final String field, final Collection<String> roots) { if (roots.size() == 1) { return eq(field, roots.iterator().next()); } final String[] values = new String[roots.size()]; int i = 0; for (final String node : roots) { values[i++] = node; } return in(field, values); }
QueryToMongodb { public static Bson getRoots(final String field, final Collection<String> roots) { if (roots.size() == 1) { return eq(field, roots.iterator().next()); } final String[] values = new String[roots.size()]; int i = 0; for (final String node : roots) { values[i++] = node; } return in(field, values); } }
QueryToMongodb { public static Bson getRoots(final String field, final Collection<String> roots) { if (roots.size() == 1) { return eq(field, roots.iterator().next()); } final String[] values = new String[roots.size()]; int i = 0; for (final String node : roots) { values[i++] = node; } return in(field, values); } private  QueryToMongodb(); }
QueryToMongodb { public static Bson getRoots(final String field, final Collection<String> roots) { if (roots.size() == 1) { return eq(field, roots.iterator().next()); } final String[] values = new String[roots.size()]; int i = 0; for (final String node : roots) { values[i++] = node; } return in(field, values); } private  QueryToMongodb(); static Bson getRoots(final String field, final Collection<String> roots); static Bson getFullCommand(final Bson command, final Bson roots); static Bson getCommand(final Query query); }
QueryToMongodb { public static Bson getRoots(final String field, final Collection<String> roots) { if (roots.size() == 1) { return eq(field, roots.iterator().next()); } final String[] values = new String[roots.size()]; int i = 0; for (final String node : roots) { values[i++] = node; } return in(field, values); } private  QueryToMongodb(); static Bson getRoots(final String field, final Collection<String> roots); static Bson getFullCommand(final Bson command, final Bson roots); static Bson getCommand(final Query query);  }