【发布时间】:2011-09-15 09:26:49
【问题描述】:
我有 MongooseJS 的 user 架构,嵌入文档 photos by 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 }
});
当我检索到一个user 时,如何限制结果集中photos 的数量?
或者我应该检索用户拥有的所有照片(即使有一百万张)?
【问题讨论】: