add more useful error messages for invalid field names#460
Closed
mjrb wants to merge 1 commit intomongodb:masterfrom
Closed
add more useful error messages for invalid field names#460mjrb wants to merge 1 commit intomongodb:masterfrom
mjrb wants to merge 1 commit intomongodb:masterfrom
Conversation
|
IMHO this is incorrect validation. In the mongo client you can update without needing $set, db.collection.update( { _id: key}, { _id: key, field: value } ) works fine, but fails in the java driver with the "Invalid BSON field name _id" exception. The same error occurs with upsert=true and having to use $set with an upsert makes no sense. So the correct fix is to remove this validation altogether. |
Collaborator
|
Closing due to inactivity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes https://jira.mongodb.org/browse/JAVA-2114. when you do an update and forget to put something like $set or $inc in the query or have an other wise malformed update query the error message wasn't very helpful even if it was a silly error. this pull request checks which field name validator failed and gives an appropriate error message.