"storage" : { "binaryStorage" : { "type" : "mongo", "host" : "localhost", "port" : 100, "username" : "test", "password" : "test", "database" : "test" } }
A binary store which persists content in MongoDB.
To use the MongoDB binary store you need to make sure the MongoDB Java Driver is available in the classpath. We recommend using the ModeShape embedded BOM which defines the required version for this artifact
"storage" : { "binaryStorage" : { "type" : "mongo", "host" : "localhost", "port" : 100, "username" : "test", "password" : "test", "database" : "test" } }
Starting with ModeShape 5.3, instead of host and port one can also configure multiple host addresses, which means that clustered MongoDB servers are also supported. For example:
"storage" : { "binaryStorage" : { "type" : "mongo", "hostAddresses" : ["192.1.68.1.1:90", "143.22.33.123:120"], "username" : "test", "password" : "test", "database" : "test" } }
host and port are still supported, but a hostAddresses array value with a single element will behave just like a single host and port
To use the MongoDB binary store you need to make sure the MongoDB Java Driver is installed as a separate module in the Wildfly Server and that ModeShape can access this module. To get the correct version for the artifact, we recommend using the ModeShape AS BOM which defines the required version number.
<repository name="sample"> <mongo-binary-storage database="test" host="localhost" port="100" password="test" username="test"/> </repository>
As with the JSON config, starting with 5.3 a host-addresses attribute is also supported which can be used to configure multiple MongoDB servers:
<mongo-binary-storage host-addresses="192.1.68.1.1:90, 143.22.33.123:120"/>
Name |
Required |
Configuration |
Description |
host |
if hostAddresses not provided |
JSON and JBoss AS |
the MongoDB server address |
port |
if hostAddresses not provided |
JSON and JBoss AS |
the MongoDB server port |
username |
no |
JSON and JBoss AS |
the name of user with which to connect to the MongoDB server |
password |
no |
JSON and JBoss AS |
the password of user with which to connect to the MongoDB server |
database |
no |
JSON and JBoss AS |
the name of the database where to store binaries. Defaults to ModeShape_BinaryStore |
hostAddresses |
if host and port not provided |
JSON and JBoss AS |
The array (or comma separated list) of host:port entries representing multiple MongoDB servers |
plus the common attributes described here