@Override @Deprecated public MorphiaIterator<T, T> tail(final boolean awaitData) { return fetch(getOptions() .copy() .cursorType(awaitData ? TailableAwait : Tailable)); }
@Override public T get(final FindOptions options) { final MorphiaIterator<T, T> it = fetch(options .copy() .limit(1)); try { return (it.hasNext()) ? it.next() : null; } finally { it.close(); } }
@Override public Key<T> getKey(final FindOptions options) { final MorphiaIterator<T, Key<T>> it = fetchKeys(options .copy() .limit(1)); Key<T> key = (it.hasNext()) ? it.next() : null; it.close(); return key; }
@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; }