[CDRIVER-845] Documents in array sent with insert command are all index 0 Created: 15/Sep/15  Updated: 19/Oct/16  Resolved: 16/Sep/15

Status: Closed
Project: C Driver
Component/s: Bulk API, libbson
Affects Version/s: None
Fix Version/s: 1.2-rc0

Type: Bug Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by CDRIVER-710 Wrong writeConcernErrors format Closed

 Description   

An array in BSON is just a document with the keys "0", "1", "2", and so on. When sending an array of documents with the "insert" command, the driver should generate BSON like:

{ "insert" : "test", "writeConcern" : {  }, "ordered" : false, "documents" : { "0": { "_id" : 1 }, "1": { "_id" : 2 }, "2": { "_id" : 3 } } }

Instead it sends:

{ "insert" : "test", "writeConcern" : {  }, "ordered" : false, "documents" : { "0": { "_id" : 1 }, "0": { "_id" : 2 }, "0": { "_id" : 3 } } }

The server accepts this, but it's not up to spec.



 Comments   
Comment by Githook User [ 11/Jan/16 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-845 fix field names in "insert" command

An array in BSON is just a document with the keys "0", "1", "2", and so
on. But when sending an array of documents with the "insert" command,
the driver had generated BSON with keys "0", "0", "0", ....
Branch: 1.3.0-dev
https://github.com/mongodb/mongo-c-driver/commit/276f0944c119812ce5318f8323360f4e2c9d36e3

Comment by Githook User [ 26/Oct/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-845 fix field names in "insert" command

An array in BSON is just a document with the keys "0", "1", "2", and so
on. But when sending an array of documents with the "insert" command,
the driver had generated BSON with keys "0", "0", "0", ....
Branch: debian
https://github.com/mongodb/mongo-c-driver/commit/276f0944c119812ce5318f8323360f4e2c9d36e3

Comment by Githook User [ 16/Sep/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-845 fix field names in "insert" command

An array in BSON is just a document with the keys "0", "1", "2", and so
on. But when sending an array of documents with the "insert" command,
the driver had generated BSON with keys "0", "0", "0", ....
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/276f0944c119812ce5318f8323360f4e2c9d36e3

Comment by A. Jesse Jiryu Davis [ 15/Sep/15 ]

"update" and "delete" commands are sent with properly-formatted BSON arrays.

Generated at Wed Feb 07 21:10:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.