[SERVER-833] update nest array item bug Created: 26/Mar/10  Updated: 12/Jul/16  Resolved: 26/Mar/10

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 1.4.0
Fix Version/s: 1.4.1, 1.5.0

Type: Bug Priority: Major - P3
Reporter: Tony Zhu Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux tanglive.com 2.6.9-78.ELsmp #1 SMP Fri Jul 25 00:04:28 EDT 2008 i686 i686 i386 GNU/Linux


Participants:

 Description   

> db.foo.insert(

{"items":[null,null,null,null]}

)
> db.foo.find()

{ "_id" : ObjectId("4bac322669b89c9179dc9976"), "items" : [ null, null, null, null ] }

> db.foo.update({_id:ObjectId("4bac322669b89c9179dc9976")},{$set:{"items.0":

{itemId:1,amount:9000}

}})
> db.foo.find()
{ "_id" : ObjectId("4bac322669b89c9179dc9976"), "items" :
[

{ "itemId" : 1, "amount" : 9000 }

, null, null, null ] }
> db.foo.update({_id:ObjectId("4bac322669b89c9179dc9976")},{$inc:

{"items.0.amount":1000}

,$set:{"items.1":

{itemId:1,amount:1}

}})
> db.foo.find()
{ "_id" : ObjectId("4bac322669b89c9179dc9976"), "items" : [

{ "itemId" : 1, "amount" : 9000 }

,

{ "itemId" : 1, "amount" : 1 }

,

{ "amount" : 1000 }

,
null,
null
] }
>

I hope that the result should be
{ "_id" : ObjectId("4bac322669b89c9179dc9976"), "items" : [

{ "itemId" : 1, "amount" : 10000 }

,

{ "itemId" : 1, "amount" : 1 }

,
null,
null,
null
] }



 Comments   
Comment by Eliot Horowitz (Inactive) [ 26/Apr/10 ]

in a release

Comment by auto [ 26/Mar/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: fix array numberic sort order SERVER-833
http://github.com/mongodb/mongo/commit/1bab750b19e1735a7fc9741e6a3a6c3ad63547c8

Comment by auto [ 26/Mar/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: fix array numberic sort order SERVER-833
http://github.com/mongodb/mongo/commit/31c93582892516f7cf379e25366160a4877b9fad

Generated at Thu Feb 08 02:55:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.