/** * Creates a copy of an existing database cursor. * The new cursor is an iterator, even if the original * was an array. * * @return the new cursor */ public DBCursor<T> copy() { return new DBCursor<T>(jacksonDBCollection, cursor.copy()); }
/** * Queries for all objects in this collection. * * @return a cursor which will iterate over every object * @throws MongoException If an error occurred */ public final DBCursor<T> find() throws MongoException { return new DBCursor<T>(this, dbCollection.find()); }
/** * Queries for all objects in this collection. * * @return a cursor which will iterate over every object * @throws MongoException If an error occurred */ public final DBCursor<T> find() throws MongoException { return new DBCursor<T>(this, dbCollection.find()); }
/** * Creates a copy of an existing database cursor. * The new cursor is an iterator, even if the original * was an array. * * @return the new cursor */ public DBCursor<T> copy() { return new DBCursor<T>(jacksonDBCollection, cursor.copy()); }
/** * Queries for an object in this collection. * * @param query object for which to search * @return an iterator over the results * @throws MongoException If an error occurred */ public DBCursor<T> find(DBObject query) throws MongoException { return new DBCursor<T>(this, dbCollection.find(serializeFields(query))); }
/** * Queries for an object in this collection. * * @param query object for which to search * @return an iterator over the results * @throws MongoException If an error occurred */ public DBCursor<T> find(DBObject query) throws MongoException { return new DBCursor<T>(this, dbCollection.find(serializeFields(query))); }
/** * Queries for an object in this collection. * * @param query object for which to search * @return an iterator over the results * @throws MongoException If an error occurred */ public DBCursor<T> find(T query) throws MongoException { return new DBCursor<T>(this, dbCollection.find(convertToBasicDbObject(query))); }
/** * Queries for an object in this collection. * * @param query object for which to search * @return an iterator over the results * @throws MongoException If an error occurred */ public DBCursor<T> find(T query) throws MongoException { return new DBCursor<T>(this, dbCollection.find(convertToBasicDbObject(query))); }
/** * Queries for an object in this collection. * <p/> * <p> * An empty DBObject will match every document in the collection. * Regardless of fields specified, the _id fields are always returned. * </p> * <p> * An example that returns the "x" and "_id" fields for every document * in the collection that has an "x" field: * </p> * <blockquote><pre> * BasicDBObject keys = new BasicDBObject(); * keys.put("x", 1); * <p/> * DBCursor cursor = collection.find(new BasicDBObject(), keys); * </pre></blockquote> * * @param query object for which to search * @param keys fields to return * @return a cursor to iterate over results */ public final DBCursor<T> find(DBObject query, DBObject keys) { return new DBCursor<T>(this, dbCollection.find(serializeFields(query), keys)); }
/** * Queries for an object in this collection. * <p/> * <p> * An empty DBObject will match every document in the collection. * Regardless of fields specified, the _id fields are always returned. * </p> * <p> * An example that returns the "x" and "_id" fields for every document * in the collection that has an "x" field: * </p> * <blockquote><pre> * BasicDBObject keys = new BasicDBObject(); * keys.put("x", 1); * <p/> * DBCursor cursor = collection.find(new BasicDBObject(), keys); * </pre></blockquote> * * @param query object for which to search * @param keys fields to return * @return a cursor to iterate over results */ public final DBCursor<T> find(DBObject query, DBObject keys) { return new DBCursor<T>(this, dbCollection.find(serializeFields(query), keys)); }
/** * Queries for an object in this collection. * <p/> * <p> * An empty DBObject will match every document in the collection. * Regardless of fields specified, the _id fields are always returned. * </p> * To keys object should have non null values for every key that you want to return * * @param query object for which to search * @param keys fields to return * @return a cursor to iterate over results */ public final DBCursor<T> find(T query, T keys) { return new DBCursor<T>(this, dbCollection.find(convertToBasicDbObject(query), convertToBasicDbObject(keys))); }
/** * Queries for an object in this collection. * <p/> * <p> * An empty DBObject will match every document in the collection. * Regardless of fields specified, the _id fields are always returned. * </p> * To keys object should have non null values for every key that you want to return * * @param query object for which to search * @param keys fields to return * @return a cursor to iterate over results */ public final DBCursor<T> find(T query, T keys) { return new DBCursor<T>(this, dbCollection.find(convertToBasicDbObject(query), convertToBasicDbObject(keys))); }