fix(collection): allow { upsert: 1 } for findOneAndUpdate() and update() - #1580
Merged
Conversation
mbroadst
approved these changes
Dec 3, 2017
Member
|
@daprahamian this will need a port to 3.0.0 |
daprahamian
approved these changes
Dec 4, 2017
jlord
approved these changes
Dec 4, 2017
daprahamian
added a commit
that referenced
this pull request
Dec 4, 2017
This is a very rough edge in the API where findAndModify() treats upsert: 1 as upsert: true, but findOneAndUpdate() and updateX() treat upsert: 1 as upsert: false. CRUD spec does say upsert is a boolean but we've had upsert: 1 in shell examples for a while so it may be worthwhile to support both, especially since truthiness is so common in JS. Port of #1580 to 3.0.0
mbroadst
pushed a commit
that referenced
this pull request
Dec 4, 2017
This is a very rough edge in the API where findAndModify() treats upsert: 1 as upsert: true, but findOneAndUpdate() and updateX() treat upsert: 1 as upsert: false. CRUD spec does say upsert is a boolean but we've had upsert: 1 in shell examples for a while so it may be worthwhile to support both, especially since truthiness is so common in JS. Port of #1580 to 3.0.0
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.
Re: Automattic/mongoose#5839
This is a very rough edge in the API where
findAndModify()treatsupsert: 1asupsert: true, butfindOneAndUpdate()andupdateX()treatupsert: 1asupsert: false. CRUD spec does sayupsertis a boolean but we've hadupsert: 1in shell examples for a while so it may be worthwhile to support both, especially since truthiness is so common in JS.