Package | Description |
---|---|
com.mongodb |
Main package with core files.
|
com.mongodb.gridfs |
GridFS tools.
|
org.bson |
Contains the base BSON classes and Encoder/Decoder.
|
Modifier and Type | Class and Description |
---|---|
class |
BasicDBList
a basic implementation of bson list that is mongo specific
|
class |
BasicDBObject
a basic implementation of bson object that is mongo specific.
|
class |
CommandResult
A simple wrapper for the result of getLastError() calls and other commands
|
class |
LazyDBObject |
class |
LazyWriteableDBObject |
class |
RawDBObject
This object wraps the binary object format ("BSON") used for the transport of serialized objects to / from the Mongo database.
|
class |
ReflectionDBObject
This class enables to map simple Class fields to a BSON object fields
|
Modifier and Type | Field and Description |
---|---|
protected DBObject |
AggregationOutput._cmd |
Modifier and Type | Field and Description |
---|---|
protected List<DBObject> |
DBCollection._hintFields |
protected Iterable<DBObject> |
AggregationOutput._resultSet |
Modifier and Type | Method and Description |
---|---|
protected DBObject |
DBCollection._checkObject(DBObject o,
boolean canBeNull,
boolean query) |
DBObject |
DBCursor.curr()
Returns the element the cursor is at.
|
DBObject |
DefaultDBDecoder.decode(byte[] b,
DBCollection collection) |
DBObject |
LazyDBDecoder.decode(byte[] b,
DBCollection collection) |
DBObject |
DBDecoder.decode(byte[] b,
DBCollection collection) |
DBObject |
DefaultDBDecoder.decode(InputStream in,
DBCollection collection) |
DBObject |
LazyDBDecoder.decode(InputStream in,
DBCollection collection) |
DBObject |
DBDecoder.decode(InputStream in,
DBCollection collection) |
DBObject |
DBCursor.explain()
Returns an object containing basic information about the
execution of the query that created this cursor
This creates a
DBObject with the key/value pairs:
"cursor" : cursor type
"nScanned" : number of records examined by the database for this query
"n" : the number of records that the database returned
"millis" : how long it took the database to execute the query |
DBObject |
DBRefBase.fetch()
fetches the object referenced from the database
|
static DBObject |
DBRef.fetch(DB db,
DBObject ref)
fetches a referenced object from the database
|
DBObject |
DBCollection.findAndModify(DBObject query,
DBObject update)
calls
DBCollection.findAndModify(com.mongodb.DBObject, com.mongodb.DBObject, com.mongodb.DBObject, boolean, com.mongodb.DBObject, boolean, boolean)
with fields=null, sort=null, remove=false, returnNew=false, upsert=false |
DBObject |
DBCollection.findAndModify(DBObject query,
DBObject sort,
DBObject update)
calls
DBCollection.findAndModify(com.mongodb.DBObject, com.mongodb.DBObject, com.mongodb.DBObject, boolean, com.mongodb.DBObject, boolean, boolean)
with fields=null, remove=false, returnNew=false, upsert=false |
DBObject |
DBCollection.findAndModify(DBObject query,
DBObject fields,
DBObject sort,
boolean remove,
DBObject update,
boolean returnNew,
boolean upsert)
Finds the first document in the query and updates it.
|
DBObject |
DBCollection.findAndRemove(DBObject query)
calls
DBCollection.findAndModify(com.mongodb.DBObject, com.mongodb.DBObject, com.mongodb.DBObject, boolean, com.mongodb.DBObject, boolean, boolean)
with fields=null, sort=null, remove=true, returnNew=false, upsert=false |
DBObject |
DBCollection.findOne()
Returns a single object from this collection.
|
DBObject |
DBCollection.findOne(DBObject o)
Returns a single object from this collection matching the query.
|
DBObject |
DBCollection.findOne(DBObject o,
DBObject fields)
Returns a single object from this collection matching the query.
|
DBObject |
DBCollection.findOne(DBObject o,
DBObject fields,
DBObject orderBy)
Returns a single obejct from this collection matching the query.
|
DBObject |
DBCollection.findOne(DBObject o,
DBObject fields,
DBObject orderBy,
ReadPreference readPref)
Returns a single object from this collection matching the query.
|
DBObject |
DBCollection.findOne(DBObject o,
DBObject fields,
ReadPreference readPref)
Returns a single object from this collection matching the query.
|
DBObject |
DBCollection.findOne(Object obj)
Finds an object by its id.
|
DBObject |
DBCollection.findOne(Object obj,
DBObject fields)
Finds an object by its id.
|
DBObject |
QueryBuilder.get()
Creates a
DBObject query to be used for the driver's find operations |
DBObject |
BasicDBObjectBuilder.get()
gets the base object
|
DBObject |
MapReduceOutput.getCommand() |
DBObject |
AggregationOutput.getCommand()
returns the original aggregation command
|
DBObject |
MapReduceCommand.getExtraOptions() |
DBObject |
DBCursor.getKeysWanted()
gets the fields to be returned
|
DBObject |
DBCursor.getQuery()
gets the query
|
DBObject |
MapReduceCommand.getQuery()
Gets the query to run for this MapReduce job
|
DBObject |
MapReduceCommand.getSort()
Gets the (optional) sort specification object
|
DBObject |
ReadPreference.TaggedReadPreference.getTags()
Deprecated.
|
DBObject |
DBCollection.group(DBObject args)
Deprecated.
prefer the
DBCollection.group(com.mongodb.GroupCommand) which is more standard
Applies a group operation |
DBObject |
DBCollection.group(DBObject key,
DBObject cond,
DBObject initial,
String reduce)
|
DBObject |
DBCollection.group(DBObject key,
DBObject cond,
DBObject initial,
String reduce,
String finalize)
Applies a group operation
|
DBObject |
DBCollection.group(DBObject key,
DBObject cond,
DBObject initial,
String reduce,
String finalize,
ReadPreference readPrefs)
Applies a group operation
|
DBObject |
DBCollection.group(GroupCommand cmd)
Applies a group operation
|
DBObject |
DBCollection.group(GroupCommand cmd,
ReadPreference readPrefs)
Applies a group operation
|
DBObject |
DBCursor.next()
Returns the object the cursor is at and moves the cursor ahead by one.
|
DBObject |
TaggableReadPreference.toDBObject() |
abstract DBObject |
ReadPreference.toDBObject() |
DBObject |
ReadPreference.TaggedReadPreference.toDBObject()
Deprecated.
|
DBObject |
MapReduceCommand.toDBObject() |
DBObject |
GroupCommand.toDBObject() |
DBObject |
Mongo.unlock()
Unlocks the database, allowing the write operations to go through.
|
Modifier and Type | Method and Description |
---|---|
List<DBObject> |
DBCollection.getIndexInfo()
Return a list of the indexes for this collection.
|
List<DBObject> |
TaggableReadPreference.getTagSets() |
Iterator<DBObject> |
DBCursor.iterator()
creates a copy of this cursor object that can be iterated.
|
Iterable<DBObject> |
MapReduceOutput.results()
returns a cursor to the results of the operation
|
Iterable<DBObject> |
AggregationOutput.results()
returns an iterator to the results of the aggregation
|
List<DBObject> |
DBCursor.toArray()
Converts this cursor to an array.
|
List<DBObject> |
DBCursor.toArray(int max)
Converts this cursor to an array.
|
Modifier and Type | Method and Description |
---|---|
protected DBObject |
DBCollection._checkObject(DBObject o,
boolean canBeNull,
boolean query) |
AggregationOutput |
DBCollection.aggregate(DBObject firstOp,
DBObject... additionalOps)
performs an aggregation operation
|
AggregationOutput |
DBCollection.aggregate(DBObject firstOp,
DBObject... additionalOps)
performs an aggregation operation
|
QueryBuilder |
QueryBuilder.and(DBObject... ands)
Equivalent to an $and operand
|
Object |
DBCollection.apply(DBObject o)
calls
DBCollection.apply(com.mongodb.DBObject, boolean) with ensureID=true |
Object |
DBCollection.apply(DBObject jo,
boolean ensureID)
calls
DBCollection.doapply(com.mongodb.DBObject) , optionally adding an automatic _id field |
CommandResult |
DB.command(DBObject cmd)
Executes a database command.
|
CommandResult |
DB.command(DBObject cmd,
DBEncoder encoder)
Executes a database command.
|
CommandResult |
DB.command(DBObject cmd,
int options)
Executes a database command.
|
CommandResult |
DB.command(DBObject cmd,
int options,
DBEncoder encoder)
Executes a database command.
|
CommandResult |
DB.command(DBObject cmd,
int options,
ReadPreference readPrefs)
Executes a database command.
|
CommandResult |
DB.command(DBObject cmd,
int options,
ReadPreference readPrefs,
DBEncoder encoder)
Executes a database command.
|
long |
DBCollection.count(DBObject query)
returns the number of documents that match a query.
|
long |
DBCollection.count(DBObject query,
ReadPreference readPrefs)
returns the number of documents that match a query.
|
DBCollection |
DB.createCollection(String name,
DBObject options)
Creates a collection with a given name and options.
|
void |
DBCollection.createIndex(DBObject keys)
calls
DBCollection.createIndex(com.mongodb.DBObject, com.mongodb.DBObject) with default index options |
void |
DBCollection.createIndex(DBObject keys,
DBObject options)
Forces creation of an index on a set of fields, if one does not already exist.
|
abstract void |
DBCollection.createIndex(DBObject keys,
DBObject options,
DBEncoder encoder)
Forces creation of an index on a set of fields, if one does not already exist.
|
List |
DBCollection.distinct(String key,
DBObject query)
find distinct values for a key
|
List |
DBCollection.distinct(String key,
DBObject query,
ReadPreference readPrefs)
find distinct values for a key
|
protected abstract void |
DBCollection.doapply(DBObject o)
Adds any necessary fields to a given object before saving it to the collection.
|
void |
DBCollection.dropIndex(DBObject keys)
Drops an index from this collection
|
QueryBuilder |
QueryBuilder.elemMatch(DBObject match)
Equivalent to the $elemMatch operand
|
void |
DBCollection.ensureIndex(DBObject keys)
calls
DBCollection.ensureIndex(com.mongodb.DBObject, com.mongodb.DBObject) with default options |
void |
DBCollection.ensureIndex(DBObject keys,
DBObject optionsIN)
Creates an index on a set of fields, if one does not already exist.
|
void |
DBCollection.ensureIndex(DBObject keys,
String name)
calls
DBCollection.ensureIndex(com.mongodb.DBObject, java.lang.String, boolean) with unique=false |
void |
DBCollection.ensureIndex(DBObject keys,
String name,
boolean unique)
Ensures an index on this collection (that is, the index will be created if it does not exist).
|
static DBObject |
DBRef.fetch(DB db,
DBObject ref)
fetches a referenced object from the database
|
DBCursor |
DBCollection.find(DBObject ref)
Queries for an object in this collection.
|
DBCursor |
DBCollection.find(DBObject ref,
DBObject keys)
Queries for an object in this collection.
|
DBCursor |
DBCollection.find(DBObject query,
DBObject fields,
int numToSkip,
int batchSize)
Deprecated.
|
DBCursor |
DBCollection.find(DBObject query,
DBObject fields,
int numToSkip,
int batchSize,
int options)
Deprecated.
|
DBObject |
DBCollection.findAndModify(DBObject query,
DBObject update)
calls
DBCollection.findAndModify(com.mongodb.DBObject, com.mongodb.DBObject, com.mongodb.DBObject, boolean, com.mongodb.DBObject, boolean, boolean)
with fields=null, sort=null, remove=false, returnNew=false, upsert=false |
DBObject |
DBCollection.findAndModify(DBObject query,
DBObject sort,
DBObject update)
calls
DBCollection.findAndModify(com.mongodb.DBObject, com.mongodb.DBObject, com.mongodb.DBObject, boolean, com.mongodb.DBObject, boolean, boolean)
with fields=null, remove=false, returnNew=false, upsert=false |
DBObject |
DBCollection.findAndModify(DBObject query,
DBObject fields,
DBObject sort,
boolean remove,
DBObject update,
boolean returnNew,
boolean upsert)
Finds the first document in the query and updates it.
|
DBObject |
DBCollection.findAndRemove(DBObject query)
calls
DBCollection.findAndModify(com.mongodb.DBObject, com.mongodb.DBObject, com.mongodb.DBObject, boolean, com.mongodb.DBObject, boolean, boolean)
with fields=null, sort=null, remove=true, returnNew=false, upsert=false |
DBObject |
DBCollection.findOne(DBObject o)
Returns a single object from this collection matching the query.
|
DBObject |
DBCollection.findOne(DBObject o,
DBObject fields)
Returns a single object from this collection matching the query.
|
DBObject |
DBCollection.findOne(DBObject o,
DBObject fields,
DBObject orderBy)
Returns a single obejct from this collection matching the query.
|
DBObject |
DBCollection.findOne(DBObject o,
DBObject fields,
DBObject orderBy,
ReadPreference readPref)
Returns a single object from this collection matching the query.
|
DBObject |
DBCollection.findOne(DBObject o,
DBObject fields,
ReadPreference readPref)
Returns a single object from this collection matching the query.
|
DBObject |
DBCollection.findOne(Object obj,
DBObject fields)
Finds an object by its id.
|
static String |
DBCollection.genIndexName(DBObject keys)
Convenience method to generate an index name from the set of fields it is over.
|
long |
DBCollection.getCount(DBObject query)
calls
DBCollection.getCount(com.mongodb.DBObject, com.mongodb.DBObject) with null fields. |
long |
DBCollection.getCount(DBObject query,
DBObject fields)
calls
DBCollection.getCount(com.mongodb.DBObject, com.mongodb.DBObject, long, long) with limit=0 and skip=0 |
long |
DBCollection.getCount(DBObject query,
DBObject fields,
long limit,
long skip)
calls
DBCollection.getCount(com.mongodb.DBObject, com.mongodb.DBObject, long, long, com.mongodb.ReadPreference) with the DBCollection's ReadPreference |
long |
DBCollection.getCount(DBObject query,
DBObject fields,
long limit,
long skip,
ReadPreference readPrefs)
Returns the number of documents in the collection
that match the specified query
|
long |
DBCollection.getCount(DBObject query,
DBObject fields,
ReadPreference readPrefs)
calls
DBCollection.getCount(com.mongodb.DBObject, com.mongodb.DBObject, long, long, com.mongodb.ReadPreference) with limit=0 and skip=0 |
DBObject |
DBCollection.group(DBObject args)
Deprecated.
prefer the
DBCollection.group(com.mongodb.GroupCommand) which is more standard
Applies a group operation |
DBObject |
DBCollection.group(DBObject key,
DBObject cond,
DBObject initial,
String reduce)
|
DBObject |
DBCollection.group(DBObject key,
DBObject cond,
DBObject initial,
String reduce,
String finalize)
Applies a group operation
|
DBObject |
DBCollection.group(DBObject key,
DBObject cond,
DBObject initial,
String reduce,
String finalize,
ReadPreference readPrefs)
Applies a group operation
|
DBCursor |
DBCursor.hint(DBObject indexKeys)
Informs the database of indexed fields of the collection in order to improve performance.
|
WriteResult |
DBCollection.insert(DBObject... arr)
Saves document(s) to the database.
|
WriteResult |
DBCollection.insert(DBObject[] arr,
WriteConcern concern)
Saves document(s) to the database.
|
WriteResult |
DBCollection.insert(DBObject[] arr,
WriteConcern concern,
DBEncoder encoder)
Saves document(s) to the database.
|
WriteResult |
DBCollection.insert(DBObject o,
WriteConcern concern)
Inserts a document into the database.
|
WriteResult |
DBCollection.insert(WriteConcern concern,
DBObject... arr)
Saves document(s) to the database.
|
MapReduceOutput |
DBCollection.mapReduce(DBObject command)
performs a map reduce operation
|
MapReduceOutput |
DBCollection.mapReduce(String map,
String reduce,
String outputTarget,
DBObject query)
performs a map reduce operation
Runs the command in REPLACE output mode (saves to named collection)
|
MapReduceOutput |
DBCollection.mapReduce(String map,
String reduce,
String outputTarget,
MapReduceCommand.OutputType outputType,
DBObject query)
performs a map reduce operation
Specify an outputType to control job execution
* INLINE - Return results inline
* REPLACE - Replace the output collection with the job output
* MERGE - Merge the job output with the existing contents of outputTarget
* REDUCE - Reduce the job output with the existing contents of
outputTarget
|
MapReduceOutput |
DBCollection.mapReduce(String map,
String reduce,
String outputTarget,
MapReduceCommand.OutputType outputType,
DBObject query,
ReadPreference readPrefs)
performs a map reduce operation
Specify an outputType to control job execution
* INLINE - Return results inline
* REPLACE - Replace the output collection with the job output
* MERGE - Merge the job output with the existing contents of outputTarget
* REDUCE - Reduce the job output with the existing contents of
outputTarget
|
static TaggableReadPreference |
ReadPreference.nearest(DBObject firstTagSet,
DBObject... remainingTagSets) |
static TaggableReadPreference |
ReadPreference.nearest(DBObject firstTagSet,
DBObject... remainingTagSets) |
QueryBuilder |
QueryBuilder.or(DBObject... ors)
Equivalent to an $or operand
|
static TaggableReadPreference |
ReadPreference.primaryPreferred(DBObject firstTagSet,
DBObject... remainingTagSets) |
static TaggableReadPreference |
ReadPreference.primaryPreferred(DBObject firstTagSet,
DBObject... remainingTagSets) |
WriteResult |
DBCollection.remove(DBObject o)
calls
DBCollection.remove(com.mongodb.DBObject, com.mongodb.WriteConcern) with the default WriteConcern |
WriteResult |
DBCollection.remove(DBObject o,
WriteConcern concern)
Removes objects from the database collection.
|
abstract WriteResult |
DBCollection.remove(DBObject o,
WriteConcern concern,
DBEncoder encoder)
Removes objects from the database collection.
|
WriteResult |
DBCollection.save(DBObject jo)
calls
DBCollection.save(com.mongodb.DBObject, com.mongodb.WriteConcern) with default WriteConcern |
WriteResult |
DBCollection.save(DBObject jo,
WriteConcern concern)
Saves an object to this collection (does insert or update based on the object _id).
|
static TaggableReadPreference |
ReadPreference.secondary(DBObject firstTagSet,
DBObject... remainingTagSets) |
static TaggableReadPreference |
ReadPreference.secondary(DBObject firstTagSet,
DBObject... remainingTagSets) |
static TaggableReadPreference |
ReadPreference.secondaryPreferred(DBObject firstTagSet,
DBObject... remainingTagSets) |
static TaggableReadPreference |
ReadPreference.secondaryPreferred(DBObject firstTagSet,
DBObject... remainingTagSets) |
void |
MapReduceCommand.setSort(DBObject sort)
Sets the (optional) sort specification object
|
DBCursor |
DBCursor.sort(DBObject orderBy)
Sorts this cursor's elements.
|
WriteResult |
DBCollection.update(DBObject q,
DBObject o)
calls
DBCollection.update(com.mongodb.DBObject, com.mongodb.DBObject, boolean, boolean) with upsert=false and multi=false |
WriteResult |
DBCollection.update(DBObject q,
DBObject o,
boolean upsert,
boolean multi)
calls
DBCollection.update(com.mongodb.DBObject, com.mongodb.DBObject, boolean, boolean, com.mongodb.WriteConcern) with default WriteConcern. |
WriteResult |
DBCollection.update(DBObject q,
DBObject o,
boolean upsert,
boolean multi,
WriteConcern concern)
Performs an update operation.
|
abstract WriteResult |
DBCollection.update(DBObject q,
DBObject o,
boolean upsert,
boolean multi,
WriteConcern concern,
DBEncoder encoder)
Performs an update operation.
|
WriteResult |
DBCollection.updateMulti(DBObject q,
DBObject o)
calls
DBCollection.update(com.mongodb.DBObject, com.mongodb.DBObject, boolean, boolean) with upsert=false and multi=true |
static TaggableReadPreference |
ReadPreference.valueOf(String name,
DBObject firstTagSet,
DBObject... remainingTagSets) |
static TaggableReadPreference |
ReadPreference.valueOf(String name,
DBObject firstTagSet,
DBObject... remainingTagSets) |
static ReadPreference |
ReadPreference.withTags(DBObject tags)
Deprecated.
As of release 2.9.0, replaced by
ReadPreference.secondaryPreferred(DBObject firstTagSet, DBObject... remainingTagSets) |
Modifier and Type | Method and Description |
---|---|
WriteResult |
DBCollection.insert(List<DBObject> list)
Saves document(s) to the database.
|
WriteResult |
DBCollection.insert(List<DBObject> list,
WriteConcern concern)
Saves document(s) to the database.
|
abstract WriteResult |
DBCollection.insert(List<DBObject> list,
WriteConcern concern,
DBEncoder encoder)
Saves document(s) to the database.
|
void |
DBCollection.setHintFields(List<DBObject> lst)
Set hint fields for this collection (to optimize queries).
|
Constructor and Description |
---|
AggregationOutput(DBObject cmd,
CommandResult raw) |
DBCursor(DBCollection collection,
DBObject q,
DBObject k,
ReadPreference preference)
Initializes a new database cursor
|
GroupCommand(DBCollection inputCollection,
DBObject keys,
DBObject condition,
DBObject initial,
String reduce,
String finalize) |
MapReduceCommand(DBCollection inputCollection,
String map,
String reduce,
String outputCollection,
MapReduceCommand.OutputType type,
DBObject query)
Represents the command for a map reduce operation
Runs the command in REPLACE output type to a named collection
|
MapReduceOutput(DBCollection from,
DBObject cmd,
CommandResult raw) |
ReadPreference.TaggedReadPreference(DBObject tags)
Deprecated.
|
Modifier and Type | Class and Description |
---|---|
class |
GridFSDBFile
This class enables to retrieve a GridFS file metadata and content.
|
class |
GridFSFile
The abstract class representing a GridFS file
|
class |
GridFSInputFile
This class represents a GridFS file to be written to the database
Operations include:
- writing data obtained from an InputStream
- getting an OutputStream to stream the data out
|
Modifier and Type | Method and Description |
---|---|
protected DBObject |
GridFSInputFile.createChunk(Object id,
int currentChunkNumber,
byte[] writeBuffer) |
DBObject |
GridFSFile.getMetaData()
Gets the file metadata
|
Modifier and Type | Method and Description |
---|---|
List<GridFSDBFile> |
GridFS.find(DBObject query)
finds a list of files matching the given query
|
List<GridFSDBFile> |
GridFS.find(DBObject query,
DBObject sort)
finds a list of files matching the given query
|
List<GridFSDBFile> |
GridFS.find(String filename,
DBObject sort)
finds a list of files matching the given filename
|
GridFSDBFile |
GridFS.findOne(DBObject query)
finds one file matching the given query
|
DBCursor |
GridFS.getFileList(DBObject query)
gets a filtered list of files stored in this gridfs, sorted by filename
|
DBCursor |
GridFS.getFileList(DBObject query,
DBObject sort)
gets a filtered list of files stored in this gridfs, sorted by param sort
|
void |
GridFS.remove(DBObject query)
removes all files matching the given query
|
void |
GridFSFile.setMetaData(DBObject metadata)
Gets the file metadata
|
Modifier and Type | Class and Description |
---|---|
class |
LazyDBList |