MongoDB Output Tool
The MongoDB Output tool is used for writing data to MongoDB databases. MongoDB is a scalable, high-performance, open source NoSQL database. Learn more about MongoDb.
MongoDB databases store data in a binary JSON format called BSON. Learn more about BSON.
Configure the tool
- Server:The name of the MongoDB server you wish to connect to. Enter localhost to connect to a MongoDb instance you have on the machine running Alteryx.
- User Name (optional) and Password (optional):If your MongoDb instance is running with the –auth option, enter the username and password you wish to connect to.
- Database:The name of the MongoDB database you wish to connect to.
- Collection:The name of the MongoDB collection you wish to push data to.
- Output Options:
- Append Existing: Append the new records onto the end of your collection
- Delete Data & Append: Deletes the collection and then adds the new records
- Update Using Mongo _id: Will attempt to match an existing record using the MongoDB _id element to the field specified in “_id field”. If a match is found then the existing record will be updated with the new one. If no match is found then the new record will be appended onto the collection.
- Mongo _id Field:When using Update Using Mongo _id, select the field that contains the _id value. To update based on the MongoDb generated ID, this should be a JSON object.
- Unknown Fields:
- Position Using Field Name: The unknown fields will be positioned using the dot notation of their names. Starting with the location of the Dynamic or Unknown Fields node as their root position.
- Position as Left: The unknown fields will added wherever the Dynamic or Unknown Fields node is positioned.
- BSON Structure: The tree view at the bottom of the tool configuration provides a visual representation of what the BSON object will look like which is going to be inserted into your collection.
- Properties
- Name:Allows you to rename any given BSON element (Note: BSON names cannot begin with $ nor contain ‘.’s)
- Folders
- Children As Name/Value: Will create child nodes as name value elements e.g. Name : { First : “Alistair” , Last : “Terry” }
- Children As Array: Will add child nodes as member of an array e.g. Name : [“Alistair” , “Terry”]
- Mode: The methpd used when processing the fields from the incoming data stream.
- Data is Value: Plain data to add to the data element of the BSON pair.
- Data is JSON: The data in a string field is already a JSON.
- Data is BSON: The data in a blob field is already a BSON.
_id" : { "$oid" : "4fad55603346998a9f7d6841" }}
The default options uses the dot notation to build the structure of the BSON object. Dot notation follows the pattern:
MemberID; Name.First; Name.Last
Passing the fields using the defaults creates the JSON object:
{ MemberID: 123, Name : { First : “Alistair” , Last : “Terry” } }
However you can restructure the BSON object to look however you would like by using the up/down/add/remove buttons.