Announcement Announcement Module
Collapse
No announcement yet.
MongoDB and limits on number of items on an embedded array of documents Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MongoDB and limits on number of items on an embedded array of documents

    Hello,

    I'm trying to see if it is possible to tell mongoDB to restrict the number of entries of an embedded attribute of array of documents. For example here is my layout:

    public class Student {
    public List<Course> courses;
    }

    public class Course {
    public String name;
    }

    How can I tell mongoDB (via mongoTemplate or repositories) to retrieve up to 3 Student's courses ? This is mainly applicable for applications that have tons of documents in the embedded array attribute and only want some of them for performance reasons.

    Thanks!

    Carlos
Working...
X