| Steps To Reproduce: |
> t.drop()
|
> t.ensureIndex({a: "2dsphere"})
|
> t.save({a: {type: "Point", coordinates: [3, 4]}})
|
> t.save({a: {type: "Point", coordinates: [1, 2]}})
|
> t.find({a: {$near: {$geometry: {type: "Point", coordinates: [1, 2]}}}})
|
{ "_id" : ObjectId("53ac81a37616f382be9e6fdb"), "a" : { "type" : "Point", "coordinates" : [ 1, 2 ] } }
|
{ "_id" : ObjectId("53ac81a07616f382be9e6fda"), "a" : { "type" : "Point", "coordinates" : [ 3, 4 ] } }
|
> t.find({a: {$near: {$geometry: {type: "Point", coordinates: [1, 2]}}}}).hint({$natural: 1})
|
{ "_id" : ObjectId("53ac81a07616f382be9e6fda"), "a" : { "type" : "Point", "coordinates" : [ 3, 4 ] } }
|
{ "_id" : ObjectId("53ac81a37616f382be9e6fdb"), "a" : { "type" : "Point", "coordinates" : [ 1, 2 ] } }
|
> t.find({a: {$near: {$geometry: {type: "Point", coordinates: [1, 2]}}}}).sort({$natural: 1})
|
{ "_id" : ObjectId("53ac81a07616f382be9e6fda"), "a" : { "type" : "Point", "coordinates" : [ 3, 4 ] } }
|
{ "_id" : ObjectId("53ac81a37616f382be9e6fdb"), "a" : { "type" : "Point", "coordinates" : [ 1, 2 ] } }
|
|