MongoClient
|
adaptClient(MongoClient client)
|
WriteResult
|
addUser(String newUsername, String newPassword)
Adds a new user for this db
|
static
String
|
bsonListToJson(BasicBSONList input)
Convert a BasicBSONList into Json.
|
void
|
connect(String username, String password, String database)
|
String
|
connectionId()
|
long
|
countObjects(String collection, DBObject query)
Counts the number of objects that match the given query.
|
long
|
countObjectsUsingQueryMap(String collection, Map<String, Object> queryAttributes)
Counts the number of objects that match the given query.
|
void
|
createCollection(String collection, boolean capped, Integer maxObjects, Integer size)
Creates a new collection.
|
DBObject
|
createFileFromPayload(Object payload, String filename, String contentType, DBObject metadata)
Creates a new GridFSFile in the database, saving the given content, filename, contentType,
and extraData, and answers it.
|
void
|
createIndex(String collection, String field, IndexOrder order)
|
static
Map
|
dbObjectToMap(DBObject input)
Convert a DBObject into Map.
|
static
String
|
dbobjectToJson(DBObject input)
Convert DBObject to Json.
|
void
|
disconnect()
|
void
|
dropCollection(String collection)
Deletes a collection and all the objects it contains.
|
void
|
dropDatabase()
Drop the current database
|
void
|
dropIndex(String collection, String index)
|
void
|
dump(String outputDirectory, String outputName, boolean zip, boolean oplog, int threads)
Executes a dump of the database to the specified output directory.
|
void
|
endConsistentRequest()
Ends a consistent request.
|
DBObject
|
executeCommand(String commandName, String commandValue)
Executes a command on the database
|
boolean
|
existsCollection(String collection)
Answers if a collection exists given its name
|
Iterable<DBObject>
|
findFiles(DBObject query)
Lists all the files that match the given query
|
Iterable<DBObject>
|
findFilesUsingQueryMap(Map<String, Object> queryAttributes)
Lists all the files that match the given query
|
Iterable<DBObject>
|
findObjects(String collection, DBObject query, List<String> fields, Integer numToSkip, Integer limit, DBObject sortBy)
Finds all objects that match a given query.
|
Iterable<DBObject>
|
findObjectsUsingQueryMap(String collection, Map<String, Object> queryAttributes, List<String> fields, Integer numToSkip, Integer limit, DBObject sortBy)
Finds all objects that match a given query.
|
DBObject
|
findOneFile(DBObject query)
Answers the first file that matches the given query.
|
DBObject
|
findOneFileUsingQueryMap(Map<String, Object> queryAttributes)
Answers the first file that matches the given query.
|
DBObject
|
findOneObject(String collection, DBObject query, List<String> fields, Boolean failOnNotFound)
Finds the first object that matches a given query.
|
DBObject
|
findOneObjectUsingQueryMap(String collection, Map<String, Object> queryAttributes, List<String> fields, Boolean failOnNotFound)
Finds the first object that matches a given query.
|
Boolean
|
getAutoConnectRetry()
|
Integer
|
getConnectTimeout()
|
Integer
|
getConnectionsPerHost()
|
String
|
getDatabase()
|
InputStream
|
getFileContent(DBObject query)
Answers an inputstream to the contents of the first file that matches the given query.
|
InputStream
|
getFileContentUsingQueryMap(Map<String, Object> queryAttributes)
Answers an inputstream to the contents of the first file that matches the given
queryAttributes.
|
String
|
getHost()
|
Integer
|
getMaxWaitTime()
|
int
|
getPort()
|
Integer
|
getSocketTimeout()
|
Integer
|
getThreadsAllowedToBlockForConnectionMultiplier()
|
void
|
incrementalDump(String outputDirectory, String incrementalTimestampFile)
Executes an incremental dump of the database
|
String
|
insertObject(String collection, DBObject dbObject, WriteConcern writeConcern)
Inserts an object in a collection, setting its id if necessary.
|
String
|
insertObjectFromMap(String collection, Map<String, Object> elementAttributes, WriteConcern writeConcern)
Inserts an object in a collection, setting its id if necessary.
|
boolean
|
isConnected()
|
static
DBObject
|
jsonToDbobject(String input)
Convert JSON to DBObject.
|
Collection<String>
|
listCollections()
Lists names of collections available at this database
|
Iterable<DBObject>
|
listFiles(DBObject query)
Lists all the files that match the given query, sorting them by filename.
|
Iterable<DBObject>
|
listFilesUsingQueryMap(Map<String, Object> queryAttributes)
Lists all the files that match the given query, sorting them by filename.
|
Collection<DBObject>
|
listIndices(String collection)
List existent indices in a collection
|
Iterable<DBObject>
|
mapReduceObjects(String collection, String mapFunction, String reduceFunction, String outputCollection)
Transforms a collection into a collection of aggregated groups, by applying a supplied
element-mapping function to each element, that transforms each one into a key-value pair,
grouping the resulting pairs by key, and finally reducing values in each group applying a
suppling 'reduce' function.
|
static
String
|
mongoCollectionToJson(MongoCollection input)
Convert a BasicBSONList into Json.
|
void
|
removeFiles(DBObject query)
Removes all the files that match the given query.
|
void
|
removeFilesUsingQueryMap(Map<String, Object> queryAttributes)
Removes all the files that match the given query.
|
void
|
removeObjects(String collection, DBObject query, WriteConcern writeConcern)
Removes all the objects that match the a given optional query.
|
void
|
removeObjectsUsingQueryMap(String collection, Map<String, Object> queryAttributes, WriteConcern writeConcern)
Removes all the objects that match the a given optional query.
|
void
|
restore(String inputPath, boolean drop, boolean oplogReplay)
Takes the output from the dump and restores it.
|
void
|
saveObject(String collection, DBObject element, WriteConcern writeConcern)
Inserts or updates an object based on its object _id.
|
void
|
saveObjectFromMap(String collection, Map<String, Object> elementAttributes, WriteConcern writeConcern)
Inserts or updates an object based on its object _id.
|
void
|
setAutoConnectRetry(Boolean autoConnectRetry)
|
void
|
setConnectTimeout(Integer connectTimeout)
|
void
|
setConnectionsPerHost(Integer connectionsPerHost)
|
void
|
setDatabase(String database)
|
void
|
setHost(String host)
|
void
|
setMaxWaitTime(Integer maxWaitTime)
|
void
|
setPort(int port)
|
void
|
setSocketTimeout(Integer socketTimeout)
|
void
|
setThreadsAllowedToBlockForConnectionMultiplier(Integer threadsAllowedToBlockForConnectionMultiplier)
|
void
|
startConsistentRequest()
Begins a consistent request, which allows you to be sure that each subsequent request to MongoDB happens in sequence.
|
void
|
updateObjects(String collection, DBObject query, DBObject element, boolean upsert, boolean multi, WriteConcern writeConcern)
Updates objects that matches the given query.
|
void
|
updateObjectsByFunction(String collection, String function, DBObject query, DBObject element, boolean upsert, boolean multi, WriteConcern writeConcern)
Update objects using a mongo function
|
void
|
updateObjectsByFunctionUsingMap(String collection, String function, Map<String, Object> queryAttributes, Map<String, Object> elementAttributes, boolean upsert, boolean multi, WriteConcern writeConcern)
Update objects using a mongo function
|
void
|
updateObjectsUsingMap(String collection, Map<String, Object> queryAttributes, Map<String, Object> elementAttributes, boolean upsert, boolean multi, WriteConcern writeConcern)
Updates objects that matches the given query.
|
void
|
updateObjectsUsingQueryMap(String collection, Map<String, Object> queryAttributes, DBObject element, boolean upsert, boolean multi, WriteConcern writeConcern)
Updates objects that matches the given query.
|