[SERVER-3045] Subset of an array with conditionals Created: 05/May/11  Updated: 29/Aug/11  Resolved: 05/May/11

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

Type: Bug Priority: Minor - P4
Reporter: Sid Assignee: Eliot Horowitz (Inactive)
Resolution: Duplicate Votes: 0
Labels: query
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

If I have a document
{
title : "My First Post", author: "Jane",
comments : [

{ by: "Abe", text: "First" }

,

{ by : "Ada", text : "Good post" }

]
}
The query:
> db.blogposts.find(

{ "comments.by" : "Ada" }

)
returns the entire comments document. If there are many elements in an array I would probably have to go through the entire array in my caller code and get the
right element. Although the index on embedded docs would find the document fast, it would be nice to have a conditional that returns only those elements of an array that are asked for. This would really avoid duplication of the search through the array in the calling client code.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 05/May/11 ]

See SERVER-828

Comment by Sid [ 05/May/11 ]

Could someone move this to the right project? i think it should go into the Core Server

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