 
                        exports.Post = mongolass.model('Post', {
  author: { type: Mongolass.Types.ObjectId },
  title: { type: 'string' },
  content: { type: 'string' },
  pv: { type: 'number' }
});
exports.Post.index({ author: 1, _id: -1 }).exec();// 按创建时间降序查看用户的文章列表  这里如何理解?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
exports.Post.index({ author: 1, _id: -1 }).exec();
上述代码是在创建复合索引(author 升序 , _id 降序)
供参考。
Love MongoDB! Have Fun!