Skip to content

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

Merged
daprahamian merged 1 commit into
mongodb:2.2from
vkarpov15:patch-2
Dec 4, 2017
Merged

fix(collection): allow { upsert: 1 } for findOneAndUpdate() and update()#1580
daprahamian merged 1 commit into
mongodb:2.2from
vkarpov15:patch-2

Conversation

@vkarpov15

Copy link
Copy Markdown
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

mbroadst commented Dec 3, 2017

Copy link
Copy Markdown
Member

@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