New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Field names with dots can be inserted if the field is > 1 level deep in array #193
Comments
I actually don't get an exception no matter what nesting level I try with. This is clearly a bug (missing constraint) in the driver as this shouldn't be permitted, and isn't if you try to insert it directly via the shell. |
MongoException is not part of this library or ext-mongodb. It was only a class in ext-mongo (i.e. the legacy extension). Can you re-check your example? That said, it appears the current extension doesn't check for dots in field names at all:
If I had to guess, we wrongfully assumed that the libmongoc API we use for handling writes was doing this already. I've opened PHPC-712 to track this. |
this is pretty old issue, but now mongo does not throw any errors and accepts the insertion even if it contains periods in the first level. Mongo version : 2.6.10 |
Driver-side validation of insert documents is addressed by PHPC-712 and will be released in
This issue is referring to newer server versions. Version 2.6 was end-of-lifed in October 2016. |
Closing this, as PHPC-712 was fixed in |
Not sure if the library is at fault or ext-mongodb 1.1.7, but field names with dots should generate a MongoException regardless of depth of array in which they are found, since mongo 3.x no longer allows dots in field names.
This issue was identified when we attempted to incorrectly insert documents with dots in field names.
For example, this will insert into mongo 3.x:
If the array is 1 level, then insert like below will fail properly:
Attempting shell insert when > 1 level deep does fail correctly though:
The text was updated successfully, but these errors were encountered: