Insert One If Not Exists
AI-generatedSummary
Insert a new document into a specified MongoDB collection only if no existing document matches the given unique filter criteria.
Inputs
- Database (required) — Name of the MongoDB database containing the target collection.
- Collection (required) — Name of the MongoDB collection into which the document will be inserted.
- Unique Filter (required) — One or more fields used to check if a matching document already exists; the document is inserted only if no document matches this filter.
- Document (required) — The fields and values of the document to insert if no existing match is found.
Output shape
a list of JSON objects indicating the operation result per input item
Each output object includes 'inserted' (boolean, true if a new document was inserted), 'exists' (boolean, true if a matching document was found and no insert occurred), and 'id' (the MongoDB ObjectId of the inserted document, or null if none inserted). The operation processes each input item independently and returns a corresponding result entry.