Example usage for Java com.mongodb MongoClient fields, constructors, methods, implement or subclass
The text is from its open source code.
MongoClient(final String host, final MongoClientOptions options) Creates a Mongo instance based on a (single) mongodb node (default port). | |
MongoClient(final String host, final int port) Creates a Mongo instance based on a (single) mongodb node. | |
MongoClient(final ServerAddress addr, final List Creates a Mongo instance based on a (single) mongodb node and a list of credentials | |
MongoClient(final ServerAddress addr, final MongoClientOptions options) Creates a Mongo instance based on a (single) mongo node using a given ServerAddress and default options. | |
MongoClient(final List Creates an instance based on a list of replica set members or mongos servers. | |
MongoClient(final List Construct an instance based on a list of replica set members or mongos servers. | |
MongoClient(final MongoClientURI uri, final MongoDriverInformation mongoDriverInformation) Creates a Mongo described by a URI. | |
MongoClient(final String host) Creates a Mongo instance based on a (single) mongodb node. | |
MongoClient(final ServerAddress addr) Creates a Mongo instance based on a (single) mongodb node | |
MongoClient(final List Creates an instance based on a list of replica set members or mongos servers. | |
MongoClient(final MongoClientURI uri) Creates a Mongo described by a URI. | |
MongoClient() Creates an instance based on a (single) mongodb node (localhost, default port). | |
MongoClient(final ServerAddress addr, final List Creates a Mongo instance based on a (single) mongo node using a given ServerAddress and default options. | |
MongoClient(final ServerAddress addr, final MongoCredential credential, final MongoClientOptions options) Creates a Mongo instance based on a (single) mongo node using a given server address, credential, and options | |
MongoClient(final List Creates an instance based on a list of replica set members or mongos servers. | |
MongoClient(final List Creates an instance based on a list of replica set members or mongos servers. |
void | close() Closes all resources associated with this instance, in particular any open network connections. |
void | dropDatabase(final String dbName) Drops the database if it exists. |
CommandResult | fsync(final boolean async) Forces the master server to fsync the RAM data to disk This is done automatically by the server at intervals, but can be forced for better reliability. |
CommandResult | fsyncAndLock() Forces the master server to fsync the RAM data to disk, then lock all writes. |
ServerAddress | getAddress() Gets the address of the current master |
List | getAllAddress() Gets a list of all server addresses used when this Mongo was created |
String | getConnectPoint() Gets a String representation of current connection point, i.e. |
MongoDatabase | getDatabase(final String databaseName) |
List | getDatabaseNames() Gets a list of the names of all databases on the connected server. |
DB | getDB(final String dbName) Gets a database object. |
CodecRegistry | getDefaultCodecRegistry() Gets the default codec registry. |
int | getMaxBsonObjectSize() Gets the maximum size for a BSON object supported by the current master server. |
MongoClientOptions | getMongoClientOptions() Gets the options that this client uses to connect to server. |
MongoOptions | getMongoOptions() Returns the mongo options. Changes to MongoOptions that are done after connection are not reflected. |
int | getOptions() Gets the default query options for reads operations executed on any DBCollection created indirectly from this instance, via a DB instance created from #getDB(String) . |
ReadPreference | getReadPreference() Gets the default read preference |
ReplicaSetStatus | getReplicaSetStatus() Get the status of the replica set cluster. |
List | getServerAddressList() Gets the list of server addresses currently seen by this client. |
WriteConcern | getWriteConcern() Gets the write concern |
boolean | isLocked() Returns true if the database is locked (read-only), false otherwise. |
MongoIterable | listDatabaseNames() Get a list of the database names |
void | setOptions(final int options) Set the default query options for reads operations executed on any DBCollection created indirectly from this instance, via a DB instance created from #getDB(String) . |
void | setReadPreference(final ReadPreference readPreference) Sets the default read preference to use for reads operations executed on any DBCollection created indirectly from this instance, via a DB instance created from #getDB(String) . |
void | setWriteConcern(final WriteConcern writeConcern) Sets the default write concern to use for write operations executed on any DBCollection created indirectly from this instance, via a DB instance created from #getDB(String) . |
String | toString() |
DBObject | unlock() Unlocks the database, allowing the write operations to go through. |