Skip to content
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

Update fails to encode _id #144

Open
johnoliver opened this issue Apr 9, 2018 · 0 comments
Open

Update fails to encode _id #144

johnoliver opened this issue Apr 9, 2018 · 0 comments

Comments

@johnoliver
Copy link
Contributor

updateCollectionWithOptions uses encodeKeyWhenUseObjectId that assumes that the _id is at the top level of the JsonObject, if an update is of the form:

{ 
  $set:{
    _id='an-id', 
    foo:'bar'
  }
}

The _id is nested so it will fail to encode the _id and throw an exception.

It may seem odd to have _id in an update, but I have tested with the mongo command line client and it accepts _id in the update provided it does not change the value. If we dont encode it we would probably need to warn people that their code needs to filter out _id from any updates.

@karianna karianna added this to the 3.x.x milestone Apr 9, 2018
@vietj vietj modified the milestones: 3.x.x, 4.0.0 Nov 29, 2018
@karianna karianna removed this from the 4.0.0 milestone May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants