MongoDB
This is an enterprise feature. |
<dependency>
<groupId>one.microstream</groupId>
<artifactId>microstream-enterprise-afs-mongodb</artifactId>
<version>07.00.00-MS-GA</version>
</dependency>
MongoClient mongoClient = MongoClients.create();
MongoDatabase database = mongoClient.getDatabase("db");
BlobStoreFileSystem fileSystem = BlobStoreFileSystem.New(
MongoDbConnector.Caching(database)
);
EmbeddedStorage.start(fileSystem.ensureDirectoryPath("microstream_storage"));
Configuration
When using external configuration MongoDB can be set as follows.
storage-filesystem.mongodb.database=mydatabase
storage-filesystem.mongodb.auth-mechanism=mongo-cr
storage-filesystem.mongodb.username=username
storage-filesystem.mongodb.password=secret
Supported properties
Property | Description |
---|---|
database |
The database name for the storage target. |
application-name |
Sets the logical name of the application using this MongoClient. The application name may be used by the client to identify the application to the server, for use in server logs, slow query logs, and profile collection. |
connection-string |
Sets the connection string to connect to the service. |
read-concern |
The read concern level. |
read-preference |
The preferred replica set members to which a query or command can be sent. |
write-concern |
Controls the acknowledgment of write operations with various options.
|
retry-reads |
Sets whether reads should be retried if they fail due to a network error. |
retry-writes |
Sets whether writes should be retried if they fail due to a network error. |
uuid-representation |
The representation to use when converting a UUID to a BSON binary value.This class is necessary because the different drivers used to have different ways of encoding UUID, with the BSON subtype: \x03 UUID old. |
credentials.auth-mechanism |
The type of the authentication mechanism. Supported values are:
|
credentials.username |
The username, used for various auth mechanisms. |
credentials.password |
The password, used for various auth mechanisms. |
credentials.source |
The source where the user is defined. This can be either "$external" or the name of a database. Used when credentials.auth-mechanism=plain. |
auth-mechanism-properties |
Further properties for the authentication mechanism. |