[CDRIVER-138] insert returns -1 code despite there being no error. Created: 17/May/12  Updated: 03/May/17  Resolved: 21/May/12

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: 0.4
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Mark Marsella Assignee: Kyle Banker
Resolution: Done Votes: 0
Labels: driver
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 12.04 64 bit



 Description   

I call mongo_insert with vaild parameters and the data is inserted into the database, however it returns -1, and prompts to look at lasterrstr, which is empty. I traced it to mongo_check_last_error which is called if you have a write_concern. Line 770 mongo.c call bson_find looking for err or $err, in the keys of the response. It isn't found however the last line of bson_find returns something.



 Comments   
Comment by Kyle Banker [ 21/May/12 ]

Thanks for the report, Mark. This commit should fix the issue. Please reopen if you still see errors.

Kyle

Comment by auto [ 21/May/12 ]

Author:

{u'login': u'banker', u'name': u'Kyle Banker', u'email': u'kylebanker@gmail.com'}

Message: CDRIVER-138 write concern return value fix
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/750b9e415f8097045d1c17367f66e691e33dbadd

Comment by Mark Marsella [ 17/May/12 ]

Just noticed that err (not $err) is a key in the response but its type in NULL so bson_find returns BSON_NULL which is 10, not 0 which is why it fails. Should the check filter err that is null?

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