标签:数据 sphere com objectid nsca time cti UNC ade
db.runCommand({ geoNear:<collection>, near:[x,y], minDistance:(对2d索引无效,对2dsphere有效), maxDistance: num: ... })
> db.runCommand({geoNear:‘location‘,near:[1,2],maxDistance:10,num:1}) { "results" : [ { "dis" : 0, "obj" : { "_id" : ObjectId("5b6b6fa872ff7510af7fc784"), "w" : [ 1, 2 ] } } ], "stats" : { "nscanned" : 3, "objectsLoaded" : 1, "avgDistance" : 0, "maxDistance" : 0, "time" : 3396 }, "ok" : 1 }
db.runCommand({geoNear:‘location‘,near:[1,2],maxDistance:10,num:2}) { "results" : [ { "dis" : 0, "obj" : { "_id" : ObjectId("5b6b6fa872ff7510af7fc784"), "w" : [ 1, 2 ] } }, { "dis" : 1, "obj" : { "_id" : ObjectId("5b6b6fa572ff7510af7fc783"), "w" : [ 1, 1 ] } } ], "stats" : { "nscanned" : 32, "objectsLoaded" : 2, "avgDistance" : 0.5, "maxDistance" : 1, "time" : 3340 }, "ok" : 1 }
标签:数据 sphere com objectid nsca time cti UNC ade
原文地址:https://www.cnblogs.com/wzndkj/p/9452776.html