[GODRIVER-659] Collection allows insertion of a nil value Created: 28/Nov/18  Updated: 28/Oct/23  Resolved: 02/Jan/19

Status: Closed
Project: Go Driver
Component/s: CRUD
Affects Version/s: None
Fix Version/s: 0.2.0

Type: Bug Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Devin Hilly (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Looks like insertion of nil translates into insertion of an empty document.  This should be treated as an error instead.



 Comments   
Comment by Devin Hilly (Inactive) [ 02/Jan/19 ]

https://github.com/mongodb/mongo-go-driver/commit/2fb348b9a4665f4934c6f48ee80e706fa920b3b4

Comment by Divjot Arora (Inactive) [ 07/Dec/18 ]

Not sure what the scope of this ticket is but do we want to change other functions besides InsertOne/InsertMany? For example, BulkWrite internally calls interfaceToDocument in dispatch.go, which also treats nil as an empty bsonx.Doc. Similar thing for the replacement in ReplaceOne.

kris.brandow devin.hilly

Generated at Thu Feb 08 08:34:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.