public <R, RK> List<R> fetch(
Collection<org.mongojack.DBRef<R, RK>> collection, DBObject fields) {
Map<JacksonCollectionKey, List<Object>> collectionsToIds = new HashMap<JacksonCollectionKey, List<Object>>();
for (org.mongojack.DBRef<R, RK> ref : collection) {
if (ref instanceof FetchableDBRef) {
JacksonCollectionKey key = ((FetchableDBRef) ref)
.getCollectionKey();
List<Object> ids = collectionsToIds.get(key);
if (ids == null) {
ids = new ArrayList<Object>();
collectionsToIds.put(key, ids);