Overview
This node performs a delete operation on a specified MongoDB collection. It allows users to define a MongoDB delete query in JSON format to specify which documents should be deleted. This operation is useful for scenarios where you need to remove documents from a MongoDB collection based on certain criteria, such as deleting records older than a specific date or removing entries matching a particular condition.
Use Case Examples
- Deleting user records from a 'users' collection where the 'birth' date is greater than '1950-01-01'.
- Removing all documents from a 'logs' collection that match a certain error code.
Properties
| Name | Meaning |
|---|---|
| Collection | The MongoDB collection from which documents will be deleted. |
| Delete Query (JSON Format) | The MongoDB delete query in JSON format that specifies which documents to delete. |
Output
JSON
deletedCount- The number of documents that were deleted as a result of the delete operation.
Dependencies
- Requires a MongoDB connection credential to connect to the database.
Troubleshooting
- If the delete query is malformed or invalid JSON, the node will throw an error. Ensure the query is correctly formatted JSON.
- If the specified collection does not exist or the database connection fails, the node will throw an error. Verify the MongoDB credentials and collection name.
- If the operation is not supported or incorrectly specified, the node will throw an error indicating the unsupported operation.