[SERVER-31337] db.collection.insert() shell helper does not support "bypassDocumentValidation" option Created: 29/Sep/17  Updated: 06/Dec/22  Resolved: 17/Dec/18

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 3.2.17, 3.4.9, 3.5.13
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Kyle Suarez Assignee: Backlog - Query Team (Inactive)
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-21671 Allow specifying bypassDocumentValida... Closed
Assigned Teams:
Query
Operating System: ALL
Steps To Reproduce:

assert.commandWorked(db.runCommand({create: "coll", validator: {a: 1}}));
assert.writeOK(db.coll.insert({a: 2}, {bypassDocumentValidation: true}));

Participants:

 Description   

Frustratingly, the db.collection.insert() shell helper silently ignores the "bypassDocumentValidation" flag. Fixing this problem is Harder Than It Sounds because the function uses the shell's Bulk API, which apparently does not have any notion of passing in options when performing an insert.

I manually inspected the shell code back to v3.2 and I believe the issue has been present since when document validation was introduced.

As a workaround, you can use db.runCommand to run the insert command directly and specify the option yourself.



 Comments   
Comment by Asya Kamsky [ 17/Dec/18 ]

Duplicate of SERVER-21671

Comment by Kyle Suarez [ 29/Sep/17 ]

Marking documentation changes as "Needed" since the shell helper's docs page should be updated after this goes in.

Generated at Thu Feb 08 04:26:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.