Java com.mongodb DBCollection fields, constructors, methods, implement or subclass

Example usage for Java com.mongodb DBCollection fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for com.mongodb DBCollection.

The text is from its open source code.

Field

Method

Cursoraggregate(final List pipeline, final AggregationOptions options, final ReadPreference readPreference, final boolean returnCursorForOutCollection)
AggregationOutputaggregate(final DBObject firstOp, final DBObject... additionalOps)
Method implements aggregation framework.
AggregationOutputaggregate(final List pipeline, final ReadPreference readPreference)
Method implements aggregation framework.
Cursoraggregate(final List pipeline, final AggregationOptions options)
Method implements aggregation framework.
AggregationOutputaggregate(final List pipeline)
Method implements aggregation framework.
Cursoraggregate(final List pipeline, final AggregationOptions options, final ReadPreference readPreference)
Method implements aggregation framework.
longcount(@Nullable final DBObject query)
Same as #getCount(DBObject)
longcount()
Same as #getCount()
voidcreateIndex(final String name)
Forces creation of an ascending index on a field with the default options.
voidcreateIndex(final DBObject keys)
Creates an index on the field specified, if that index does not already exist.
voidcreateIndex(final DBObject keys, final String name)
Forces creation of an index on a set of fields, if one does not already exist.
voidcreateIndex(final DBObject keys, final DBObject options)
Creates an index on the field specified, if that index does not already exist.
voidcreateIndex(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.
Listdistinct(final String fieldName)
Find the distinct values for a specified field across a collection and returns the results in an array.
Listdistinct(final String fieldName, final ReadPreference readPreference)
Find the distinct values for a specified field across a collection and returns the results in an array.
Listdistinct(final String fieldName, final DBObject query)
Find the distinct values for a specified field across a collection and returns the results in an array.
Listdistinct(final String fieldName, final DBCollectionDistinctOptions options)
Find the distinct values for a specified field across a collection and returns the results in an array.
voiddrop()
Drops (deletes) this collection from the database.
voiddropIndex(final DBObject index)
Drops an index from this collection.
voiddropIndex(final String indexName)
Drops the index with the given name from this collection.
voiddropIndexes()
Drop all indexes on this collection.
DBCursorfind(final DBObject query, final DBObject projection)
Select documents in collection and get a cursor to the selected documents.
DBCursorfind(@Nullable final DBObject query, final DBCollectionFindOptions options)
Select documents in collection and get a cursor to the selected documents.
DBCursorfind()
Select all documents in collection and get a cursor to the selected documents.
DBCursorfind(final DBObject query)
Select documents in collection and get a cursor to the selected documents.
DBCursorfind(final DBObject query, final DBObject projection, final int numToSkip, final int batchSize)
Select documents in collection and get a cursor to the selected documents.
DBObjectfindAndModify(@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.
DBObjectfindAndModify(@Nullable final DBObject query, final DBObject update)
Atomically modify and return a single document.
DBObjectfindAndModify(final DBObject query, final DBCollectionFindAndModifyOptions options)
Atomically modify and return a single document.
DBObjectfindAndModify(@Nullable final DBObject query, @Nullable final DBObject sort, final DBObject update)
Atomically modify and return a single document.
DBObjectfindAndRemove(@Nullable final DBObject query)
Atomically remove and return a single document.
DBObjectfindOne(final DBObject query)
Get a single document from collection.
DBObjectfindOne(final Object id)
Get a single document from collection by '_id'.
DBObjectfindOne()
Get a single document from collection.
DBObjectfindOne(final DBObject query, final DBObject projection)
Get a single document from collection.
DBObjectfindOne(final Object id, final DBObject projection)
Get a single document from collection by '_id'.
DBObjectfindOne(@Nullable final DBObject query, final DBCollectionFindOptions findOptions)
Get a single document from collection.
DBObjectfindOne(final DBObject query, final DBObject projection, final DBObject sort)
Get a single document from collection.
DBObjectfindOne(final DBObject query, final DBObject projection, final ReadPreference readPreference)
Get a single document from collection.
DBObjectfindOne(@Nullable final DBObject query, @Nullable final DBObject projection, @Nullable final DBObject sort, final ReadPreference readPreference)
Get a single document from collection.
DBCollectiongetCollection(final String name)
Find a collection that is prefixed with this collection's name.
longgetCount(final ReadPreference readPreference)
Get the count of documents in collection.
longgetCount(@Nullable final DBObject query)
Get the count of documents in collection that would match a criteria.
longgetCount()
Get the count of documents in collection.
longgetCount(@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.
DBgetDB()
Returns the database this collection is a member of.
DBDecoderFactorygetDBDecoderFactory()
Get the decoder factory for this collection.
StringgetFullName()
Get the full name of a collection, with the database name as a prefix.
ListgetIndexInfo()
Return a list of the indexes for this collection.
StringgetName()
Get the name of a collection.
intgetOptions()
Gets the default query options
ReadPreferencegetReadPreference()
Gets the ReadPreference .
CommandResultgetStats()
The collStats command returns a variety of storage statistics for a given collection
WriteConcerngetWriteConcern()
Get the WriteConcern for this collection.
DBObjectgroup(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.
DBObjectgroup(final GroupCommand cmd)
Group documents in a collection by the specified key and performs simple aggregation functions such as computing counts and sums.
DBObjectgroup(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.
BulkWriteOperationinitializeOrderedBulkOperation()

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.

BulkWriteOperationinitializeUnorderedBulkOperation()

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.

WriteResultinsert(final DBObject... documents)
Insert documents into a collection.
WriteResultinsert(final List documents)
Insert documents into a collection.
WriteResultinsert(final DBObject document, final WriteConcern writeConcern)
Insert a document into a collection.
WriteResultinsert(final WriteConcern writeConcern, final DBObject... documents)
Insert documents into a collection.
WriteResultinsert(final DBObject[] documents, final WriteConcern writeConcern)
Insert documents into a collection.
WriteResultinsert(final List documents, final WriteConcern aWriteConcern)
Insert documents into a collection.
WriteResultinsert(final List documents, final InsertOptions insertOptions)

Insert documents into a collection.

WriteResultinsert(final DBObject[] documents, final WriteConcern aWriteConcern, final DBEncoder encoder)
Insert documents into a collection.
WriteResultinsert(final List documents, final WriteConcern aWriteConcern, @Nullable final DBEncoder dbEncoder)
Insert documents into a collection.
booleanisCapped()
Checks whether this collection is capped
MapReduceOutputmapReduce(final MapReduceCommand command)
Allows you to run map-reduce aggregation operations over a collection.
MapReduceOutputmapReduce(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.
MapReduceOutputmapReduce(final String map, final String reduce, final String outputTarget, final DBObject query)
Allows you to run map-reduce aggregation operations over a collection.
ListparallelScan(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.

WriteResultremove(final DBObject query)
Remove documents from a collection.
WriteResultremove(final DBObject query, final WriteConcern writeConcern)
Remove documents from a collection.
WriteResultremove(final DBObject query, final DBCollectionRemoveOptions options)
Remove documents from a collection.
WriteResultremove(final DBObject query, final WriteConcern writeConcern, final DBEncoder encoder)
Remove documents from a collection.
DBCollectionrename(final String newName, final boolean dropTarget)
Change the name of an existing collection.
DBCollectionrename(final String newName)
Change the name of an existing collection.
WriteResultsave(final DBObject document)
Update an existing document or insert a document depending on the parameter.
WriteResultsave(final DBObject document, final WriteConcern writeConcern)
Update an existing document or insert a document depending on the parameter.
voidsetDBDecoderFactory(@Nullable final DBDecoderFactory factory)
Set a custom decoder factory for this collection.
voidsetDBEncoderFactory(@Nullable final DBEncoderFactory factory)
Set a custom encoder factory for this collection.
voidsetObjectClass(final Class aClass)
Sets a default class for objects in this collection; null resets the class to nothing.
voidsetOptions(final int options)
Sets the default query options, overwriting previous value.
voidsetReadPreference(final ReadPreference preference)
Sets the ReadPreference for this collection.
voidsetWriteConcern(final WriteConcern writeConcern)
Set the WriteConcern for this collection.
StringtoString()
WriteResultupdate(final DBObject query, final DBObject update)
Modify an existing document.
WriteResultupdate(final DBObject query, final DBObject update, final boolean upsert, final boolean multi)
Modify an existing document or documents in collection.
WriteResultupdate(final DBObject query, final DBObject update, final boolean upsert, final boolean multi, final WriteConcern aWriteConcern)
Modify an existing document or documents in collection.
WriteResultupdate(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.
WriteResultupdateMulti(final DBObject query, final DBObject update)
Modify documents in collection.