
dbc.setHintFields(null)
虽然3.0以后版本中 DBCollection方法 已过时,可以将就用
直接用 $hint *** 作符
db.users.find( { name: {}, $hint: { age : 1 } } )
参考地址
https://docs.mongodb.org/manual/reference/operator/meta/hint/#metaOp._S_hint
举例:db.users.ensureIndex({age:1})
如果使用编程,一般驱动也会有相应的设置索引的方法。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)