[SERVER-646] Bug in aggregation Created: 17/Feb/10  Updated: 12/Jul/16  Resolved: 17/Feb/10

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 1.2.3

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

Mac OS X


Participants:

 Description   

I have this collection
> db.alunos.find({},

{armario:1, idade:1}

)

{"_id" : ObjectId( "4b7c3d34ca4fb4692dd91c5b") , "idade" : 9 , "armario" : ["Sandwich de presunto","Foto da Popis"]} {"_id" : ObjectId( "4b7c3d19ca4fb4692dd91c59") , "idade" : 8 , "armario" : ["Boneca de pano"]} {"_id" : ObjectId( "4b7c3d2dca4fb4692dd91c5a") , "idade" : 9}

I try to aggregate like this
> db.alunos.group({
key:

{ idade: true }

,
initial:

{ armario: [] }

,
reduce: function(aluno, grupo) {
if (aluno.armario) {
aluno.armario.forEach(function(objeto)

{ grupo.armario.push(objeto); }

)
}
},
finalize: function(out) {}
})
[

{"idade" : 9 , "armario" : ["Sandwich de presunto","Foto da Popis","Boneca de pano"]}

,

{"idade" : 8 , "armario" : ["Sandwich de presunto","Foto da Popis","Boneca de pano"]}

]

Notice that it is aggregating all objects in all keys. That shouldn`t be happening.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 17/Feb/10 ]

ok - this has been fixed in 1.2 for quite a while.
we haven' been able to get macports updated

Comment by Pedro Menezes [ 17/Feb/10 ]

1.0.0_1 via MacPorts.

Comment by Eliot Horowitz (Inactive) [ 17/Feb/10 ]

what version are you running?

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