Mongo DB OID icon

Mongo DB OID

Find, insert and update documents in MongoDB

Overview

This node performs an insert operation into a specified MongoDB collection. It allows users to insert new documents into the database by specifying the collection name and the fields to include in the new documents. It supports parsing certain fields as MongoDB Date or ObjectId types and optionally using dot notation for nested fields. This node is useful for scenarios where new data needs to be added to a MongoDB database, such as adding new user records, product entries, or any other document-based data.

Use Case Examples

  1. Inserting new user profiles into a 'users' collection by specifying fields like 'name' and 'email'.
  2. Adding new product details into a 'products' collection with fields such as 'name', 'description', and 'price'.
  3. Inserting event logs into a 'logs' collection with date fields parsed as MongoDB Date type.

Properties

Name Meaning
Collection The MongoDB collection where the new documents will be inserted.
Fields Comma-separated list of the fields to be included in the new document.
Options Additional options for the insert operation, including date fields to parse as Mongo Date type, whether to use dot notation for nested fields, and fields to parse as Mongo ObjectId type.

Output

JSON

  • id - The unique identifier of the inserted document.
    - Each field specified in the input fields will be included in the output document with its corresponding value.

Dependencies

  • MongoDB database connection
  • An API key credential for MongoDB authentication

Troubleshooting

  • Common issues include connection failures due to incorrect credentials or connection strings, which result in errors during the connection test or execution.
  • Errors may occur if the specified collection does not exist or if the fields provided are invalid or improperly formatted.
  • Parsing errors can happen if date or ObjectId fields are not correctly specified or formatted.
  • The node throws errors for unsupported operations or if the insert operation fails; enabling 'Continue On Fail' allows processing to continue with error details in the output.

Discussion