-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
-
Empty show more show less
-
Not Needed
What problem are you facing?
If the fullResponse option is set to true for an insertMany call, the 'insertedCount' field in the response is always equal to zero. If not included, or set to false, then that field contains the correct number of inserted documents.
What driver and relevant dependency versions are you using?
mongodb@4.0.1
Steps to reproduce?
const documents = [ /* 4 docs to insert */ ]; const db = mongoClient.db(databaseName); const collection = db.collection(collectionName); const result = await collection.insertMany(documents, {fullResponse: true}); // results.insertedCount = 0 // results.insertedIds has 4 document IDs
If fullResponse is not included in the options, or is set to false, then insertedCount is correctly be set to 4.
As a side-note, setting fullResponse to true doesn't actually include any additional information in the response, which might be a bigger issue.
- is related to
-
NODE-3547 TypeError: Cannot read property 'n' of undefined
- Closed