|
I attempted to reproduce this problem both by applying the patch from Charlie's comment above, and by running the following against a debug build:
> db.createCollection("c", {validator: {illegalField: {$exists: false}}})
|
{ "ok" : 1 }
|
> db.d.insert({illegalField: true})
|
WriteResult({ "nInserted" : 1 })
|
> db.d.aggregate([{$out: "c"}], {cursor: {batchSize: 0}})
|
Error: getMore command failed: {
|
"ok" : 0,
|
"errmsg" : "insert for $out failed: { connectionId: 1, err: \"Document failed validation\", code: 121, codeName: \"DocumentValidationFailure\", n: 0, ok: 1.0 }",
|
"code" : 16996,
|
"codeName" : "Location16996"
|
}
|
I could not reproduce by either method. Therefore, I believe this problem has been fixed, almost certainly as a consequence of the changes for SERVER-22541. Closing as Gone Away.
|
|
This was discovered by this test case that was later removed in jstests/views/views_aggregation.js:
diff --git a/jstests/views/views_aggregation.js b/jstests/views/views_aggregation.js
|
index 2544f2a..5a9c010 100644
|
--- a/jstests/views/views_aggregation.js
|
+++ b/jstests/views/views_aggregation.js
|
@@ -172,16 +172,6 @@
|
assert.writeOK(viewsDB.invalidDocs.insert({illegalField: "present"}));
|
assert.commandWorked(viewsDB.createView("invalidDocsView", "invalidDocs", []));
|
|
+ assertErrorCode(
|
+ viewsDB.invalidDocsView,
|
+ [{$out: validatedCollName}],
|
+ 16996,
|
+ "Expected $out insertions to fail validation because 'bypassDocumentValidation' was not" +
|
+ " specified");
|
+
|
assert.commandWorked(
|
viewsDB.runCommand({
|
aggregate: "invalidDocsView",
|
When this issue is fixed, we should consider re-adding this test case.
|
|
After some discussion, we've decided that this bug is very difficult to hit, likely not high impact, and will be substantially easier to fix after resolving SERVER-22541.
I'm marking this as 3.5 Required, and as depending on SERVER-22541.
|