优化查询性能
创建索引以支持查询
db.posts.createIndex( { author_name : 1 } )
db.posts.createIndex( { timestamp : 1 } )db.posts.find().sort( { timestamp : -1 } )
限制查询的结果数以减少网络需求
使用投影仅返回必要的数据
使用$hint选择一个特定的指数
$hint选择一个特定的指数使用增量运算符在服务器端执行操作
最后更新于