@Override public MorphiaIterator<T, T> fetchEmptyEntities(final FindOptions options) { QueryImpl<T> cloned = cloneQuery(); cloned.getOptions().projection(new BasicDBObject(Mapper.ID_KEY, 1)); cloned.includeFields = true; return cloned.fetch(); }
@Override public MorphiaKeyIterator<T> fetchKeys(final FindOptions options) { QueryImpl<T> cloned = cloneQuery(); cloned.getOptions().projection(new BasicDBObject(Mapper.ID_KEY, 1)); cloned.includeFields = true; return new MorphiaKeyIterator<T>( ds, cloned.prepareCursor(options), ds.getMapper(), clazz, dbColl.getName()); }
@Override public QueryImpl<T> cloneQuery() { final QueryImpl<T> n = new QueryImpl<T>(clazz, dbColl, ds); n.cache = ds.getMapper().createEntityCache(); // fresh cache n.includeFields = includeFields; n.setQuery(n); // feels weird, correct? n.validateName = validateName; n.validateType = validateType; n.baseQuery = copy(baseQuery); n.options = options != null ? options.copy() : null; // fields from superclass n.setAttachedTo(getAttachedTo()); n.setChildren(getChildren() == null ? null : new ArrayList<Criteria>(getChildren())); return n; }