Components Crossplatform Mac & Win Server Client Old Deprecated Guides Examples Videos
New in version: 11.1 11.2 11.3 11.4 11.5 12.0 12.1 12.2 12.3 12.4 Statistic FMM Blog
Insert documents into collection.
|MongoDB||12.4||✅ Yes||✅ Yes||✅ Yes||✅ Yes||✅ Yes|
|MongoDBRef||The reference number for the mongo connection.||$MongoDB|
|documentJSON||The JSON with an array of the records to save.|
|OptionsJSON||The options to use.||Optional|
Returns OK or error.
DescriptionInsert documents into collection.
Please pass a JSON array as string for all documents. Each entry in the array should be a JSON object with the document data.
For any document that does not have an "_id" field, a bson_oid_t will be generated locally and added to the document. If you must know the inserted document's _id, generate it in your code and include it in the document. The _id you generate can be a bson_oid_t or any other non-array BSON type.
The reply is filled out with an "insertedCount" field. If there is a server error then reply may contain a "writeErrors" array and/or a "writeConcernErrors" array.
- Version 12.4
- Added MongoDB.InsertMany function to insert multiple records in one operation.
Created 26th July 2022, last changed 26th July 2022
Feedback: Report problem or ask question.