How to retrieve portion of collection?

Hello guys, I’m new with mongodb and I’m stucked with a stupid (for you) problem.
I try to explain the problem.
I have a personal_feed document with user_id and an array of feed. The feed document has a name and an array of profile_id.
How I can find the personal_feed of a specific user (by user_id), getting a specific feed (by name) and return the first 10 element in profile_id?

user_id: 1,
name: “feed1”,
profiles_id: […]
name: “feed2”,
profiles_id: […]


For instance, I want retrieve the first 10 profiles_id of the feed with name “feed2” of the personal_feed with user_id=1

Thanks for every hint

You want to study MongoDB aggregation. M121: The MongoDB Aggregation Framework | MongoDB University
Really Aggregation is the answer to life, the universe, and everything in MongoDB outside of server admin.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.