MongoDB

If you use MongoDB cloud and want to connect your DB with Baseet.ai, then there are some helpful nodes for that.

MongoDB nodes on Baseet

MongoDB consider database as collections and each collection has a document of key-value pair:

Connect MongoDB Node

From your MongoDB Cloud cluster, connect to get the uri string to your connection.

So you get the uri_string from previous step, ex:

uri_string= "mongodb+srv://<username>:<password>@cluster0-xnqqo.mongodb.net/test?retryWrites=true&w=majority"

And you know the username and password to your connection, then you will use them as inputs for the node.

The output is Client-side representation of the MongoDB cluster, you use it to access your cluster.

Insert into Document - MongoDB Node

If you have a data as key-value pair (dictionary) and want to insert it into your document, then you need to provide the following:

Inputs

  • Client for your cluster

  • Collection name from your database

  • Document name that you want to insert data into it

  • Dictionary data as the data you want to be inserted

Outputs

  • Message to show if the insertion is successful or failed

Dump document to df - MongoDB Node

If you want to dump a document from your collection into a dataframe, then you can use the following node:

Inputs

  • Client for your cluster

  • Collection name where the document refer to

  • Document name that you want to dumped into dataframe

Outputs

  • Dataframe generated

Write df to document - MongoDB Node

If you want to write the dataframe into new document, then you can use the following node:

Inputs:

  • Client to your cluster

  • Collection name where to save the new document

  • New document name to save the dataframe

Outputs

  • Message to show if the process is successful or failed

Sample App

Baseet provides sample apps for beginners to show how to use specific nodes. For Mongo database, follow (MongoDB Database Connector - Example) app to show the usage for each node.

(MongoDB Database Connector - Example) App

Hints:

  • For Write df to document - MongoDB Node:

    • New_document_name: should be new and not exist in the database