Mat*_*ich 5 sorting indexing mongodb mongodb-query
我的集合中的"已创建"字段有两个单独的索引.一个索引按升序排序,另一个索引按降序排序.按降序排序的索引大于按升序排序的索引.创建的字段包含Javascript Date对象.什么会导致这个?
"indexSizes" : {
"_id_" : 212862160,
"created_1" : 136424736,
"created_-1" : 252376768
},
Run Code Online (Sandbox Code Playgroud)
以下是collection.getIndexes()的详细信息.唯一的区别是在后台创建了降序索引.
{
"v" : 1,
"key" : {
"created" : 1
},
"name" : "created_1",
"ns" : "Production.accounts"
},
{
"v" : 1,
"key" : {
"created" : -1
},
"name" : "created_-1",
"ns" : "Production.accounts",
"background" : true
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
76 次 |
| 最近记录: |