public class MongoClientImpl extends Object implements MongoClient
Constructor and Description |
---|
MongoClientImpl(com.mongodb.MongoClient mongo,
String database) |
Modifier and Type | Method and Description |
---|---|
org.bson.Document |
addUser(String username,
String password) |
void |
close() |
long |
countObjects(String collection,
org.bson.conversions.Bson query) |
void |
createCollection(String collection,
boolean capped,
Integer maxObjects,
Integer size) |
com.mongodb.DBObject |
createFile(InputStream content,
String filename,
String contentType,
com.mongodb.DBObject metadata) |
void |
createIndex(String collection,
String field,
IndexOrder order) |
void |
dropCollection(String collection) |
void |
dropDatabase() |
void |
dropIndex(String collection,
String name) |
org.bson.Document |
executeCommand(org.bson.Document command) |
boolean |
existsCollection(String collection) |
Iterable<com.mongodb.DBObject> |
findFiles(com.mongodb.DBObject query) |
Iterable<org.bson.Document> |
findObjects(String collection,
org.bson.Document query,
List<String> fields,
Integer numToSkip,
Integer limit,
org.bson.Document sortBy) |
com.mongodb.DBObject |
findOneFile(com.mongodb.DBObject query) |
org.bson.Document |
findOneObject(String collection,
org.bson.Document query,
List<String> fields,
boolean failOnNotFound) |
com.mongodb.client.MongoCollection<org.bson.Document> |
getCollection(String collection) |
String |
getConnectionId() |
com.mongodb.client.MongoDatabase |
getDatabase(String databaseName) |
com.mongodb.client.MongoDatabase |
getDb() |
InputStream |
getFileContent(com.mongodb.DBObject query) |
protected com.mongodb.gridfs.GridFS |
getGridFs() |
String |
insertObject(String collection,
org.bson.Document document) |
boolean |
isAlive() |
Iterable<String> |
listCollections() |
Iterable<com.mongodb.DBObject> |
listFiles(com.mongodb.DBObject query) |
Collection<org.bson.Document> |
listIndices(String collection) |
Iterable<org.bson.Document> |
mapReduceObjects(String collection,
String mapFunction,
String reduceFunction,
String outputCollection) |
void |
removeFiles(com.mongodb.DBObject query) |
void |
removeObjects(String collection,
org.bson.conversions.Bson query) |
void |
saveObject(String collectionName,
org.bson.Document document) |
org.bson.Document |
updateObjects(String collection,
org.bson.Document query,
org.bson.Document document,
boolean multi,
boolean upsert) |
public MongoClientImpl(com.mongodb.MongoClient mongo, String database)
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public com.mongodb.client.MongoDatabase getDatabase(String databaseName)
getDatabase
in interface MongoClient
public long countObjects(@NotNull String collection, org.bson.conversions.Bson query)
countObjects
in interface MongoClient
public void createCollection(@NotNull String collection, boolean capped, Integer maxObjects, Integer size)
createCollection
in interface MongoClient
public com.mongodb.client.MongoCollection<org.bson.Document> getCollection(@NotNull String collection)
getCollection
in interface MongoClient
public org.bson.Document addUser(String username, String password)
addUser
in interface MongoClient
public void dropDatabase()
dropDatabase
in interface MongoClient
public void dropCollection(@NotNull String collection)
dropCollection
in interface MongoClient
public boolean existsCollection(@NotNull String collection)
existsCollection
in interface MongoClient
public Iterable<org.bson.Document> findObjects(@NotNull String collection, @NotNull org.bson.Document query, List<String> fields, Integer numToSkip, Integer limit, org.bson.Document sortBy)
findObjects
in interface MongoClient
public org.bson.Document findOneObject(@NotNull String collection, @NotNull org.bson.Document query, List<String> fields, boolean failOnNotFound)
findOneObject
in interface MongoClient
public String insertObject(@NotNull String collection, @NotNull org.bson.Document document)
insertObject
in interface MongoClient
public Iterable<String> listCollections()
listCollections
in interface MongoClient
public Iterable<org.bson.Document> mapReduceObjects(@NotNull String collection, @NotNull String mapFunction, @NotNull String reduceFunction, String outputCollection)
mapReduceObjects
in interface MongoClient
public void removeObjects(@NotNull String collection, @NotNull org.bson.conversions.Bson query)
removeObjects
in interface MongoClient
public void saveObject(@NotNull String collectionName, @NotNull org.bson.Document document)
saveObject
in interface MongoClient
public org.bson.Document updateObjects(@NotNull String collection, @NotNull org.bson.Document query, org.bson.Document document, boolean multi, boolean upsert)
updateObjects
in interface MongoClient
public void createIndex(String collection, String field, IndexOrder order)
createIndex
in interface MongoClient
public void dropIndex(String collection, String name)
dropIndex
in interface MongoClient
public Collection<org.bson.Document> listIndices(String collection)
listIndices
in interface MongoClient
public com.mongodb.DBObject createFile(@NotNull InputStream content, @NotNull String filename, String contentType, com.mongodb.DBObject metadata)
createFile
in interface MongoClient
public Iterable<com.mongodb.DBObject> findFiles(com.mongodb.DBObject query)
findFiles
in interface MongoClient
public com.mongodb.DBObject findOneFile(@NotNull com.mongodb.DBObject query)
findOneFile
in interface MongoClient
public InputStream getFileContent(@NotNull com.mongodb.DBObject query)
getFileContent
in interface MongoClient
public Iterable<com.mongodb.DBObject> listFiles(@NotNull com.mongodb.DBObject query)
listFiles
in interface MongoClient
public void removeFiles(@NotNull com.mongodb.DBObject query)
removeFiles
in interface MongoClient
public org.bson.Document executeCommand(org.bson.Document command)
executeCommand
in interface MongoClient
protected com.mongodb.gridfs.GridFS getGridFs()
public com.mongodb.client.MongoDatabase getDb()
public boolean isAlive()
isAlive
in interface MongoClient
public String getConnectionId()
getConnectionId
in interface MongoClient
Copyright © 2010–2015. All rights reserved.