在探查器中,我发现一个查询看起来好像要取出三个锁,一个全局锁,一个数据库锁和一个集合锁。
请解释为什么它使用了指定的锁,如果我读错了它,请更正我。
{
"op" : "query",
"ns" : "RGC.AlkRgcs_40_-86",
"command" : {
"find" : "AlkRgcs_40_-86",
"filter" : {
"Heading" : 8,
"Location" : {
"$near" : {
"$geometry" : {
"type" : "Point",
"coordinates" : [
-86.16914829999999,
39.5389771
]
},
"$maxDistance" : 50
}
}
},
"limit" : 1,
"maxTimeMS" : 250,
"$db" : "RGC",
"$readPreference" : {
"mode" : "secondaryPreferred"
},
"lsid" : {
"id" : UUID("d8cc3f21-476e-4f2f-a5af-d23b6aa9e4f5")
},
"$clusterTime" : {
"clusterTime" : Timestamp(1545099439, 4170),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
}
},
"keysExamined" : 396,
"docsExamined" : 362,
"cursorExhausted" : true,
"numYield" : 3,
"nreturned" : 1,
"locks" : {
"Global" : {
"acquireCount" : {
"r" : NumberLong(4)
}
},
"Database" : {
"acquireCount" : {
"r" : NumberLong(4)
}
},
"Collection" : {
"acquireCount" : {
"r" : NumberLong(4)
}
}
},
"responseLength" : 1067,
"protocol" : "op_msg",
"millis" : 4,
"planSummary" : "GEO_NEAR_2DSPHERE { Location: \"2dsphere\", Heading: 1 }",
"execStats" : {
"stage" : "LIMIT",
"nReturned" : 1,
"executionTimeMillisEstimate" : 0,
"works" : 399,
"advanced" : 1,
"needTime" : 397,
"needYield" : 0,
"saveState" : 3,
"restoreState" : 3,
"isEOF" : 1,
"invalidates" : 0,
"limitAmount" : 1,
"inputStage" : {
"stage" : "GEO_NEAR_2DSPHERE",
"nReturned" : 1,
"executionTimeMillisEstimate" : 0,
"works" : 398,
"advanced" : 1,
"needTime" : 397,
"needYield" : 0,
"saveState" : 3,
"restoreState" : 3,
"isEOF" : 0,
"invalidates" : 0,
"keyPattern" : {
"Location" : "2dsphere",
"Heading" : 1
},
"indexName" : "Locations",
"indexVersion" : 2,
"searchIntervals" : [
{
"minDistance" : 0,
"maxDistance" : 3.3284465774864755,
"maxInclusive" : false,
"nBuffered" : 362,
"nReturned" : 1
}
],
"inputStage" : {
"stage" : "FETCH",
"nReturned" : 362,
"executionTimeMillisEstimate" : 0,
"works" : 396,
"advanced" : 362,
"needTime" : 33,
"needYield" : 0,
"saveState" : 3,
"restoreState" : 3,
"isEOF" : 1,
"invalidates" : 0,
"docsExamined" : 362,
"alreadyHasObj" : 0,
"inputStage" : {
"stage" : "IXSCAN",
"nReturned" : 362,
"executionTimeMillisEstimate" : 0,
"works" : 396,
"advanced" : 362,
"needTime" : 33,
"needYield" : 0,
"saveState" : 3,
"restoreState" : 3,
"isEOF" : 1,
"invalidates" : 0,
"keyPattern" : {
"Location" : "2dsphere",
"Heading" : 1
},
"indexName" : "Locations",
"isMultiKey" : false,
"multiKeyPaths" : {
"Location" : [ ],
"Heading" : [ ]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"Location" : [
"[-8628896886041870336, -8628896886041870336]",
"[-8616793462043312128, -8616793462043312128]",
"[-8616723093299134464, -8616723093299134464]",
"[-8616683510880534528, -8616683510880534528]",
"[-8616680487223558144, -8616680487223558144]",
"[-8616680418504081408, -8616680418504081408]",
"[-8616680414209114112, -8616680414209114112]",
"[-8616680411793195008, -8616680411793195008]",
"[-8616680411776417792, -8616680411776417792]",
"[-8616680411774058496, -8616680411774058496]",
"[-8616680411773992960, -8616680411773992960]",
"[-8616680411773992959, -8616680411773960193]",
"[-8616680411773960191, -8616680411773927425]",
"[-8616680411773730816, -8616680411773730816]",
"[-8616680411773730815, -8616680411773698049]",
"[-8616680411773599744, -8616680411773599744]",
"[-8616680411773599743, -8616680411773566977]",
"[-8616680411773566975, -8616680411773534209]",
"[-8616680411773534208, -8616680411773534208]",
"[-8616680411773534207, -8616680411773403137]",
"[-8616680411773403135, -8616680411773272065]",
"[-8616680411773272064, -8616680411773272064]",
"[-8616680411773272063, -8616680411772747777]",
"[-8616680411772747775, -8616680411772616705]",
"[-8616680411772616703, -8616680411772485633]",
"[-8616680411772485632, -8616680411772485632]",
"[-8616680411772223488, -8616680411772223488]",
"[-8616680411726086144, -8616680411726086144]",
"[-8616680411679948800, -8616680411679948800]",
"[-8616680411679358976, -8616680411679358976]",
"[-8616680411679358975, -8616680411679326209]",
"[-8616680411679293439, -8616680411679162369]",
"[-8616680411679162368, -8616680411679162368]",
"[-8616680411679162367, -8616680411679031297]",
"[-8616680411679031295, -8616680411678900225]",
"[-8616680411678900224, -8616680411678900224]",
"[-8616680411678834688, -8616680411678834688]",
"[-8616680411678801919, -8616680411678769153]",
"[-8616680411678769151, -8616680411678638081]",
"[-8616680411678638080, -8616680411678638080]",
"[-8616680411678605311, -8616680411678572545]",
"[-8616680411678572544, -8616680411678572544]",
"[-8616680411675754496, -8616680411675754496]",
"[-8616680410987888640, -8616680410987888640]",
"[-8616680401324212224, -8616680401324212224]",
"[-8616680212345651200, -8616680212345651200]",
"[-8616670316741001216, -8616670316741001216]",
"[-8616511987066601472, -8616511987066601472]",
"[-8615386087159758848, -8615386087159758848]",
"[-8574853690513424384, -8574853690513424384]"
],
"Heading" : [
"[8, 8]"
]
},
"keysExamined" : 395,
"seeks" : 34,
"dupsTested" : 0,
"dupsDropped" : 0,
"seenInvalidated" : 0
}
}
}
},
"ts" : ISODate("2018-12-18T02:17:20.196Z"),
"client" : "10.154.18.107",
"allUsers" : [ ],
"user" : ""
}