示例#1
0
 @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();
 }
示例#2
0
  @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());
  }
示例#3
0
  @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;
  }