I have a userschema for MongooseJSwith an embedded document photoson PhotoSchema:
var UserSchema = new Schema({
email : { type : String, index : 'unique', set: toLower }
, login : { type : String, index : 'unique' }
, password : { type : String }
, salt : { type : String }
, photos : [ PhotoSchema ]
, name : { type : String }
});
When I return one user, how can I limit the number photosin the result set?
Or do I need to get all the photos a user has (even if there is a million)?
source
share