Skip to content

Commit 9293941

Browse files
committed
NODE-568 fixed docs for insertOne
1 parent 5684094 commit 9293941

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

lib/collection.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ define.classMethod('find', {callback: false, promise:false, returns: [Cursor]});
368368
* @param {boolean} [options.serializeFunctions=false] Serialize functions on any object.
369369
* @param {boolean} [options.forceServerObjectId=false] Force server to assign _id values instead of driver.
370370
* @param {boolean} [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher.
371-
* @param {Collection~insertWriteOpCallback} [callback] The command result callback
371+
* @param {Collection~insertOneWriteOpCallback} [callback] The command result callback
372372
* @return {Promise} returns Promise if no callback passed
373373
*/
374374
Collection.prototype.insertOne = function(doc, options, callback) {
@@ -700,13 +700,31 @@ define.classMethod('bulkWrite', {callback: true, promise:true});
700700
* @property {Number} result.n The total count of documents inserted.
701701
*/
702702

703+
/**
704+
* @typedef {Object} Collection~insertOneWriteOpResult
705+
* @property {Number} insertedCount The total amount of documents inserted.
706+
* @property {object[]} ops All the documents inserted using insertOne/insertMany/replaceOne. Documents contain the _id field if forceServerObjectId == false for insertOne/insertMany
707+
* @property {ObjectId} insertedId The driver generated ObjectId for the insert operation.
708+
* @property {object} connection The connection object used for the operation.
709+
* @property {object} result The raw command result object returned from MongoDB (content might vary by server version).
710+
* @property {Number} result.ok Is 1 if the command executed correctly.
711+
* @property {Number} result.n The total count of documents inserted.
712+
*/
713+
703714
/**
704715
* The callback format for inserts
705716
* @callback Collection~insertWriteOpCallback
706717
* @param {MongoError} error An error instance representing the error during the execution.
707718
* @param {Collection~insertWriteOpResult} result The result object if the command was executed successfully.
708719
*/
709720

721+
/**
722+
* The callback format for inserts
723+
* @callback Collection~insertOneWriteOpCallback
724+
* @param {MongoError} error An error instance representing the error during the execution.
725+
* @param {Collection~insertOneWriteOpResult} result The result object if the command was executed successfully.
726+
*/
727+
710728
/**
711729
* Inserts a single document or a an array of documents into MongoDB.
712730
* @method

0 commit comments

Comments
 (0)