MongoDB is a popular NoSQL database. Gtmhub can connect to any collection in MongoDB database. As MongoDB has no schema, Gtmhub samples that data and creates an implicit schema.

How to connect

  • In Gtmhub, navigate to Setup > Data Sources screen
  • Click on the Add new Data Source button
  • From the Choose a Data Source dialog, select MongoDB from Databases tab

Enter the necessary information to connect to your MongoDB database:

  • host: host name or IP address of your MongoDB instance
  • database: the name of the database to which you wish to connect
  • username: the name of the user with which you wish to connect
  • password: the password of the user with which you wish to connect
  • port: the port where MongoDB is listening. The default is 27017, which is a standard MongoDB port

Click on the Connect button

  • Choose a collection to which you want to connect and click on the Use ... button
  • Give the name to your data source, something that makes sense to you and select the sync schedule (how often you want this data source to be synced automatically)
  • Click on the Add my data source button

    Note: Gtmhub will be connecting from IP address 185.14.186.49, so make sure your firewall and MongoDB database are configured to allow a connection from that IP address.

What data from MongoDB can I use

Since MongoDB is a NoSQL database and hence does not have a defined schema, Gtmhub will sample the data present in the collection and infer an implicit schema.

You can sync any "field" from any collection in any database that is accessible to the user with which you connected to MongoDB database.

Gtmhub will automatically coerce types for you, so for example you can map ObjectId type to String.

Did this answer your question?