rdbms » MongoDB Connection Setup
Connecting to MongoDB
MongoDB is not a relational database. It is another form of database called
NoSQL that provides a mechanism for managing unstructured (or non-tabular)
data structure. As a convenience, Nexial provides MongoDb connectivity via the rdbms
commands so that those familar
with the rdbms
command type might be able to adapt quickly to automating with MongoDb.
Connecting to MongoDb via Nexial is similar to how one would connect to MongoDb directly. One can utilize the same
MongoDb connection URL. Be sure to specify the
<connection name>.type
as mongodb
, and supply the appropriate credentials via the <connection name>.user
and
<connection name>.password
data variables. For example:
In addition, there’s another specialized data variable - <connection name>.expandDocument
to “expand” the retrieved
document into columns. This may be of some help as one would be able to directly access the retrieved document via its
top-level key. For example, by default each document retrieved (such as using
db.find() command) would be shown as a
“document” column in separate rows:
As shown above, each row contains a “document” column, each with the corresponding retrieved JSON document.
When the .expandDocument
is set to true
, the retrieved document is “expanded” into individual columns:
It is possible to connect to MongoDB via SSL/TLS. However there is a bit of upfront (one-time) work to get it working:
- Obtain the appropriate
.pem
file for the target MongoDB server. - Run the following command with the
keytool
utility that comes with your Java installation (in$JAVA_HOME/bin
):
keytool -importcert -trustcacerts -file <pem file location> -keystore <trust store location> -storepass <password>
- Now reference the generated “trust store” file in your MongoDB connectivity: