MongoDB Connections
Last updated
Last updated
MongoDB connection enables Data Shaper to interact with the â„¢ NoSQL database [1].
Analogous to other connections in Data Shaper, MongoDB connections can be created both internally and externally. See sections and to learn how to create them. Definition process for MongoDB connections is very similar to other connections, just select Create MongoDB connection instead of Create DB connection.
From the connection properties, Connection Name, Host(s) and Database Instance are mandatory.
In this field, type a name you want for this connection. Note that if you are creating a new connection, the connection name you enter here will be used to generate an ID of the connection. Whereas the connection name is just an informational label, the connection ID is used to reference this connection from various graph components. Once the connection is created, the ID cannot be changed using this dialog to avoid accidental breaking of references (if you want to change the ID of existing connection, you can do so in the Properties view).
Enter the host name (or IP address) and port number in the form host[:port]
. If the port number is not specified, the default port 27017 will be used.
If you need to connect to a replica set or a Cluster, enter a comma-separated list of hosts.
The user name used for authentication.
The password used for authentication.
The name of the MongoDB database to connect to. The database is also used for authentication by default, this can be changed with the Authentication Database property (see below).
The database used for authentication. If not filled in, the working database is used as an authentication database.
Enables SSL encryption
Disables the validations of certificates. Useful with self-signed certificates.
This table allows you to fine-tune some MongoDB parameters. Usually, leaving it empty is just fine.
Optional. By default, an embedded driver will be used for the connection. Usually, you don’t need to provide a custom driver library, because the bundled driver should be backwards compatible.
If you want to use a custom driver, for versions 4.x you need to add four jars: mongodb-driver-core-*.jar
, mongodb-driver-sync-*.jar
, mongodb-driver-legacy-*.jar
and bson-*.jar
, all in the same version.
For older versions, there is a single jar containing all the required classes: mongo-java-driver-*.jar
,
The paths to the driver library can be absolute or project relative. Graph parameters can be used as well.
Note that even though the connector tries to maximize backward compatibility, using an outdated version of the driver library may lead to java.lang.NoClassDefFoundError
or java.lang.NoSuchMethodError
being thrown.
The connection has primarily been tested with the bundled driver version 4.6.0, it should work with newer driver versions as well. It has also been successfully tested with prior driver versions up to 2.3, but the functionality may be limited.
Usage on the Data Shaper Server
If you do define the library paths, note that absolute paths are absolute paths on the application server. Relative paths are sandbox (project) relative and will work only if the library is located in a shared sandbox.
Once you’ve finished setting up your MongoDB connection, click the Validate connection button to verify that the parameters you entered can be used to successfully establish a connection. Note that connection validation is unfortunately not available if the driver library is located in (remote) Data Shaper Server sandbox.
[1] MongoDB is a trademark of MongoDB Inc.
The list of available options depends on the version of the driver library used. See if you use driver version 2.10.0 or newer. The options have the same names as the setter methods of the class.
For older driver versions, see of the respective version. The options have the same names as the fields of the class.