[DOCS-957] findAndModify 2.2 Release Notes Unclear on the Command's Response Created: 07/Jan/13  Updated: 07/Jan/13  Resolved: 07/Jan/13

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Steve Francia Assignee: Sam Kleinman (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 11 years, 6 weeks, 2 days ago

 Description   

http://docs.mongodb.org/manual/release-notes/2.2/#findandmodify-returns-null
http://docs.mongodb.org/manual/reference/command/findAndModify/

Behavior outlined is incorrect... claims null returned always (or the odd ok: 1.0 hash), but this isn't the case and the correct behavior is more akin to what one would expect.

> db.t.findAndModify({query:

{name: "Steve"}

, upsert: true, update: {name: "John"}})
null
> db.t.findAndModify({query:

{name: "John"}

, upsert: true, update: {name: "Johnny"}})

{ "_id" : ObjectId("50eb188773015b3832f64dda"), "name" : "John" }

> db.t.findAndModify({query:

{name: "Tyler"}

, new: true, upsert: true, update: {name: "Johnny"}})

{ "_id" : ObjectId("50eb18e473015b3832f64ddc"), "name" : "Johnny" }

>



 Comments   
Comment by auto [ 07/Jan/13 ]

Author:

{u'date': u'2013-01-07T20:33:27Z', u'email': u'samk@10gen.com', u'name': u'Sam Kleinman'}

Message: DOCS-957: clarification based on comments from @TylerBrock
Branch: master
https://github.com/mongodb/docs/commit/62375e44edd27a76a437c287385c0d5c77643b87

Comment by Steve Francia [ 07/Jan/13 ]

reviewed. It looks right to me now.

Best,
Steve
*
*
--------------------------------
*
*
*

{ *name : *"**Steve Francia**", * * *title : *"*Chief Evangelist*"*, twitter : *"*@spf13 <http://twitter.com/spf13>*"*, web : *"*spf13.com*"*, location : *"*New York, NY*"* *}

*

<http://10gen.com>

Comment by Sam Kleinman (Inactive) [ 07/Jan/13 ]

Changes made in referenced commit

spf13, tyler@10gen.com, and skot could you please review?

Comment by Steve Francia [ 07/Jan/13 ]

Totally understand and it's documenting the command inaccurately.

I just reviewed it with Sam and he's now clear on what should be done.

Comment by auto [ 07/Jan/13 ]

Author:

{u'date': u'2013-01-07T19:31:03Z', u'email': u'samk@10gen.com', u'name': u'Sam Kleinman'}

Message: DOCS-957: clarification behavior on upserts that turn into inserts
Branch: master
https://github.com/mongodb/docs/commit/6dc838ead0723fe79dfe76f647b2541d147ab15b

Comment by Scott Hernandez (Inactive) [ 07/Jan/13 ]

Steve, that is documenting the command, not the shell helper. There is a big difference... and maybe we can make that more clear for people who don't see that immediately.

Generated at Thu Feb 08 07:39:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.