[SERVER-13894] Is possible to Paging nested array ?! Created: 09/May/14  Updated: 10/Dec/14  Resolved: 09/May/14

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

Type: Question Priority: Major - P3
Reporter: Giuseppe Quartarone Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

This is my case :

#The Object Container :

{
_id : 0,
_class : Container,
products : [
{ // first product
name : "applepie",

// this is an HashMap
ingredients : {

{ name : "apple", gr : 1000 }

,

{ name : "flour", gr : 300 }

}
},

{ // second product ..... some utils..... }

]
}

I want to show only a few of ingredients of a specific product,
but how can i paging the result ?!



 Comments   
Comment by Giuseppe Quartarone [ 10/May/14 ]

Sorry and thanks :'')

Comment by Thomas Rueckstiess [ 09/May/14 ]

Hi Giuseppe,

You may find the $slice projection operator useful, although you may have to redesign your schema for that to work and use arrays to store ingredients.

In general, this SERVER project is for reporting bugs or feature suggestions for the MongoDB server.

For MongoDB-related questions and support please post on the mongodb-users group (http://groups.google.com/group/mongodb-user) or Stack Overflow with the mongodb tag. A question like this involving more discussion would be best posted on the mongodb-users group.

Kind Regards,
Thomas

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