-
Type: Bug
-
Resolution: Duplicate
-
Priority: Minor - P4
-
None
-
Affects Version/s: 3.4.9
-
Component/s: Admin, Internal Client, Internal Code, Querying
-
None
-
ALL
-
Hi
I was trying to add document validation to avoid an issue with our software where a document, containing an array of DBRefs was saved back with those DBRefs resolved to their foreign documents. In other words, to validate that the items in this array member are indeed DBRefs.
As DBRef is not available as a $type to check against, I had to get creative and instead opted for this not-exactly-foolprof idea: Either, the member must not exist, or it must be an array of objects which does not have an _id property.
In my testing, it becomes clear that it stops rejecting invalid updates once the array contains one valid member. In essence, the validator seems to say, "yep, everything okay" so long as the validator rule, if used as a query, would yield the document being validated.
I don't see this behavior mentioned anywhere in the docs, so I'm thinking it's a bug. Please see my steps to reproduce for clarification.
- duplicates
-
SERVER-31401 Document validator fails to reject invalid values in array member
- Closed