Example usage for Java com.mongodb DBCollection fields, constructors, methods, implement or subclass
The text is from its open source code.
String | ID_FIELD_NAME |
Cursor | aggregate(final List extends DBObject> pipeline, final AggregationOptions options, final ReadPreference readPreference, final boolean returnCursorForOutCollection) |
AggregationOutput | aggregate(final DBObject firstOp, final DBObject... additionalOps) Method implements aggregation framework. |
AggregationOutput | aggregate(final List extends DBObject> pipeline, final ReadPreference readPreference) Method implements aggregation framework. |
Cursor | aggregate(final List extends DBObject> pipeline, final AggregationOptions options) Method implements aggregation framework. |
AggregationOutput | aggregate(final List extends DBObject> pipeline) Method implements aggregation framework. |
Cursor | aggregate(final List extends DBObject> pipeline, final AggregationOptions options, final ReadPreference readPreference) Method implements aggregation framework. |
long | count(@Nullable final DBObject query) Same as #getCount(DBObject) |
long | count() Same as #getCount() |
void | createIndex(final String name) Forces creation of an ascending index on a field with the default options. |
void | createIndex(final DBObject keys) Creates an index on the field specified, if that index does not already exist. |
void | createIndex(final DBObject keys, final String name) Forces creation of an index on a set of fields, if one does not already exist. |
void | createIndex(final DBObject keys, final DBObject options) Creates an index on the field specified, if that index does not already exist. |
void | createIndex(final DBObject keys, @Nullable final String name, final boolean unique) Forces creation of an index on a set of fields, if one does not already exist. |
List | distinct(final String fieldName) Find the distinct values for a specified field across a collection and returns the results in an array. |
List | distinct(final String fieldName, final ReadPreference readPreference) Find the distinct values for a specified field across a collection and returns the results in an array. |
List | distinct(final String fieldName, final DBObject query) Find the distinct values for a specified field across a collection and returns the results in an array. |
List | distinct(final String fieldName, final DBCollectionDistinctOptions options) Find the distinct values for a specified field across a collection and returns the results in an array. |
void | drop() Drops (deletes) this collection from the database. |
void | dropIndex(final DBObject index) Drops an index from this collection. |
void | dropIndex(final String indexName) Drops the index with the given name from this collection. |
void | dropIndexes() Drop all indexes on this collection. |
DBCursor | find(final DBObject query, final DBObject projection) Select documents in collection and get a cursor to the selected documents. |
DBCursor | find(@Nullable final DBObject query, final DBCollectionFindOptions options) Select documents in collection and get a cursor to the selected documents. |
DBCursor | find() Select all documents in collection and get a cursor to the selected documents. |
DBCursor | find(final DBObject query) Select documents in collection and get a cursor to the selected documents. |
DBCursor | find(final DBObject query, final DBObject projection, final int numToSkip, final int batchSize) Select documents in collection and get a cursor to the selected documents. |
DBObject | findAndModify(@Nullable final DBObject query, @Nullable final DBObject fields, @Nullable final DBObject sort, final boolean remove, @Nullable final DBObject update, final boolean returnNew, final boolean upsert) Atomically modify and return a single document. |
DBObject | findAndModify(@Nullable final DBObject query, final DBObject update) Atomically modify and return a single document. |
DBObject | findAndModify(final DBObject query, final DBCollectionFindAndModifyOptions options) Atomically modify and return a single document. |
DBObject | findAndModify(@Nullable final DBObject query, @Nullable final DBObject sort, final DBObject update) Atomically modify and return a single document. |
DBObject | findAndRemove(@Nullable final DBObject query) Atomically remove and return a single document. |
DBObject | findOne(final DBObject query) Get a single document from collection. |
DBObject | findOne(final Object id) Get a single document from collection by '_id'. |
DBObject | findOne() Get a single document from collection. |
DBObject | findOne(final DBObject query, final DBObject projection) Get a single document from collection. |
DBObject | findOne(final Object id, final DBObject projection) Get a single document from collection by '_id'. |
DBObject | findOne(@Nullable final DBObject query, final DBCollectionFindOptions findOptions) Get a single document from collection. |
DBObject | findOne(final DBObject query, final DBObject projection, final DBObject sort) Get a single document from collection. |
DBObject | findOne(final DBObject query, final DBObject projection, final ReadPreference readPreference) Get a single document from collection. |
DBObject | findOne(@Nullable final DBObject query, @Nullable final DBObject projection, @Nullable final DBObject sort, final ReadPreference readPreference) Get a single document from collection. |
DBCollection | getCollection(final String name) Find a collection that is prefixed with this collection's name. |
long | getCount(final ReadPreference readPreference) Get the count of documents in collection. |
long | getCount(@Nullable final DBObject query) Get the count of documents in collection that would match a criteria. |
long | getCount() Get the count of documents in collection. |
long | getCount(@Nullable final DBObject query, @Nullable final DBObject projection, final long limit, final long skip) Get the count of documents in collection that would match a criteria. |
DB | getDB() Returns the database this collection is a member of. |
DBDecoderFactory | getDBDecoderFactory() Get the decoder factory for this collection. |
String | getFullName() Get the full name of a collection, with the database name as a prefix. |
List | getIndexInfo() Return a list of the indexes for this collection. |
String | getName() Get the name of a collection. |
int | getOptions() Gets the default query options |
ReadPreference | getReadPreference() Gets the ReadPreference . |
CommandResult | getStats() The collStats command returns a variety of storage statistics for a given collection |
WriteConcern | getWriteConcern() Get the WriteConcern for this collection. |
DBObject | group(final DBObject key, final DBObject cond, final DBObject initial, final String reduce, @Nullable final String finalize) Group documents in a collection by the specified key and performs simple aggregation functions such as computing counts and sums. |
DBObject | group(final GroupCommand cmd) Group documents in a collection by the specified key and performs simple aggregation functions such as computing counts and sums. |
DBObject | group(final DBObject key, final DBObject cond, final DBObject initial, final String reduce) Group documents in a collection by the specified key and performs simple aggregation functions such as computing counts and sums. |
BulkWriteOperation | initializeOrderedBulkOperation() Creates a builder for an ordered bulk write operation, consisting of an ordered collection of write requests, which can be any combination of inserts, updates, replaces, or removes. |
BulkWriteOperation | initializeUnorderedBulkOperation() Creates a builder for an unordered bulk operation, consisting of an unordered collection of write requests, which can be any combination of inserts, updates, replaces, or removes. |
WriteResult | insert(final DBObject... documents) Insert documents into a collection. |
WriteResult | insert(final List extends DBObject> documents) Insert documents into a collection. |
WriteResult | insert(final DBObject document, final WriteConcern writeConcern) Insert a document into a collection. |
WriteResult | insert(final WriteConcern writeConcern, final DBObject... documents) Insert documents into a collection. |
WriteResult | insert(final DBObject[] documents, final WriteConcern writeConcern) Insert documents into a collection. |
WriteResult | insert(final List extends DBObject> documents, final WriteConcern aWriteConcern) Insert documents into a collection. |
WriteResult | insert(final List extends DBObject> documents, final InsertOptions insertOptions) Insert documents into a collection. |
WriteResult | insert(final DBObject[] documents, final WriteConcern aWriteConcern, final DBEncoder encoder) Insert documents into a collection. |
WriteResult | insert(final List extends DBObject> documents, final WriteConcern aWriteConcern, @Nullable final DBEncoder dbEncoder) Insert documents into a collection. |
boolean | isCapped() Checks whether this collection is capped |
MapReduceOutput | mapReduce(final MapReduceCommand command) Allows you to run map-reduce aggregation operations over a collection. |
MapReduceOutput | mapReduce(final String map, final String reduce, final String outputTarget, final MapReduceCommand.OutputType outputType, final DBObject query) Allows you to run map-reduce aggregation operations over a collection and saves to a named collection. |
MapReduceOutput | mapReduce(final String map, final String reduce, final String outputTarget, final DBObject query) Allows you to run map-reduce aggregation operations over a collection. |
List | parallelScan(final ParallelScanOptions options) Return a list of cursors over the collection that can be used to scan it in parallel. Note: As of MongoDB 2.6, this method will work against a mongod, but not a mongos. |
WriteResult | remove(final DBObject query) Remove documents from a collection. |
WriteResult | remove(final DBObject query, final WriteConcern writeConcern) Remove documents from a collection. |
WriteResult | remove(final DBObject query, final DBCollectionRemoveOptions options) Remove documents from a collection. |
WriteResult | remove(final DBObject query, final WriteConcern writeConcern, final DBEncoder encoder) Remove documents from a collection. |
DBCollection | rename(final String newName, final boolean dropTarget) Change the name of an existing collection. |
DBCollection | rename(final String newName) Change the name of an existing collection. |
WriteResult | save(final DBObject document) Update an existing document or insert a document depending on the parameter. |
WriteResult | save(final DBObject document, final WriteConcern writeConcern) Update an existing document or insert a document depending on the parameter. |
void | setDBDecoderFactory(@Nullable final DBDecoderFactory factory) Set a custom decoder factory for this collection. |
void | setDBEncoderFactory(@Nullable final DBEncoderFactory factory) Set a custom encoder factory for this collection. |
void | setObjectClass(final Class extends DBObject> aClass) Sets a default class for objects in this collection; null resets the class to nothing. |
void | setOptions(final int options) Sets the default query options, overwriting previous value. |
void | setReadPreference(final ReadPreference preference) Sets the ReadPreference for this collection. |
void | setWriteConcern(final WriteConcern writeConcern) Set the WriteConcern for this collection. |
String | toString() |
WriteResult | update(final DBObject query, final DBObject update) Modify an existing document. |
WriteResult | update(final DBObject query, final DBObject update, final boolean upsert, final boolean multi) Modify an existing document or documents in collection. |
WriteResult | update(final DBObject query, final DBObject update, final boolean upsert, final boolean multi, final WriteConcern aWriteConcern) Modify an existing document or documents in collection. |
WriteResult | update(final DBObject query, final DBObject update, final boolean upsert, final boolean multi, final WriteConcern concern, @Nullable final DBEncoder encoder) Modify an existing document or documents in collection. |
WriteResult | updateMulti(final DBObject query, final DBObject update) Modify documents in collection. |