[SERVER-65176] Convert undefined to null on insert/update Created: 01/Apr/22  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Colby Ing Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Execution
Participants:

 Description   

Whenever mongosh tries to insert undefined values, those undefined values get converted to null in the driver logic. This effectively ensures that users of mongosh are not able to insert any values of undefined type into MongoDB. This is not true in the legacy mongo shell, as the legacy shell allows you to insert values of undefined type. 

 

Instead of this implicit conversion from undefined -> null on the driver side, we should perform that conversion on the server side, to effectively disallow any insertion of new undefined values into MDB collections. 



 Comments   
Comment by Kyle Suarez [ 19/Apr/22 ]

Per a conversation with colby.ing@mongodb.com on Slack, sending this to the backlog as we don't intend to start this project just yet.

Comment by David Storch [ 12/Apr/22 ]

Another option would be throw an assertion if the application tries to write a new undefined value.

I'm also curious what the performance overhead is on the insert/update path for either approach.

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