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

fix(collection): allow { upsert: 1 } for findOneAndUpdate() and update() #1580

Merged
merged 1 commit into from
Dec 4, 2017
Merged

fix(collection): allow { upsert: 1 } for findOneAndUpdate() and update() #1580

merged 1 commit into from
Dec 4, 2017

Conversation

vkarpov15
Copy link
Contributor

Re: Automattic/mongoose#5839

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.

@mbroadst
Copy link
Member

mbroadst commented Dec 3, 2017

@daprahamian this will need a port to 3.0.0

@daprahamian daprahamian merged commit 0f338c8 into mongodb:2.2 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants