Skip to main content

[en] MongoDB Output Tool Icon MongoDB Output Tool

警告

[en] The MongoDB Output tool is deprecated. You can still use the Output Data tool with the ODBC driver linked on the MongoDB datasource page to connect to MongoDB.

[en] 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.

[en] MongoDB databases store data in a binary JSON format called BSON. Learn more about BSON.

注意

[en] Long numbers are rounded when inserted to DB. To avoid this, you can turn the number into a string by adding quotes.

[en] Tool Configuration

  1. [en] 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.

  2. [en] 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.

  3. [en] Database: The name of the MongoDB database you wish to connect to.

  4. [en] Collection: The name of the MongoDB collection you wish to push data to.

  5. [en] Output Options:

    • [en] Append Existing: Append the new records onto the end of your collection

    • [en] Delete Data & Append: Deletes the collection and then adds the new records

    • [en] 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.

  6. [en] 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.

    • [en] _id" : { "$oid" : "4fad55603346998a9f7d6841" }}

  7. [en] Unknown Fields:

    • [en] 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.

    • [en] Position as Left: The unknown fields will added wherever the Dynamic or Unknown Fields node is positioned.

  8. [en] 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.

    • [en] The default options uses the dot notation to build the structure of the BSON object. Dot notation follows the pattern:

      • [en] MemberID; Name.First; Name.Last

    • [en] Passing the fields using the defaults creates the JSON object:

      • [en] { MemberID: 123, Name : { First : “Alistair” , Last : “Terry” } }

      • [en] However, you can restructure the BSON object to look however you would like by using the up/down/add/remove buttons.

  9. [en] Properties

    • [en] Name: Allows you to rename any given BSON element (Note: BSON names cannot begin with $ nor contain ‘.’s)

    • [en] Folders

      • [en] Children As Name/Value: Will create child nodes as name value elements e.g. Name : { First : “Alistair” ,Last : “Terry” }

      • [en] Children As Array: Will add child nodes as member of an array e.g. Name : [“Alistair” , “Terry”]

    • [en] Mode: The methpd used when processing the fields from the incoming data stream.

      • [en] Data is Value: Plain data to add to the data element of the BSON pair.

      • [en] Data is JSON: The data in a string field is already a JSON.

      • [en] Data is BSON: The data in a blob field is already a BSON.

警告

[en] This tool shouldn’t be used to write to an AlteryxServer MongoDB because this can result in database corruption.