diff options
Diffstat (limited to 'jstests/readonly/geo.js')
-rw-r--r-- | jstests/readonly/geo.js | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/jstests/readonly/geo.js b/jstests/readonly/geo.js index 1127a70a18f..367cb89be96 100644 --- a/jstests/readonly/geo.js +++ b/jstests/readonly/geo.js @@ -10,28 +10,33 @@ runReadOnlyTest(function() { assert.commandWorked(writableCollection.createIndex({loc: "2dsphere"})); var locDocs = [ - {name: "Berry Park", - loc: {type: "Point", coordinates: [40.722396, -73.9573645]}}, - {name: "Northern Territory", - loc: {type: "Point", coordinates: [40.7252334, -73.9595218]}}, - {name: "Kent Ale House", - loc: {type: "Point", coordinates: [40.7223364, -73.9614495]}}, - {name: "The Shanty", - loc: {type: "Point", coordinates: [40.7185752, -73.9510538]}}, - {name: "The Counting Room", - loc: {type: "Point", coordinates: [40.7209601, -73.9588041]}}, - {name: "Kinfolk 94", - loc: {type: "Point", coordinates: [40.7217058, -73.9605489]}} + {name: "Berry Park", loc: {type: "Point", coordinates: [40.722396, -73.9573645]}}, + { + name: "Northern Territory", + loc: {type: "Point", coordinates: [40.7252334, -73.9595218]} + }, + { + name: "Kent Ale House", + loc: {type: "Point", coordinates: [40.7223364, -73.9614495]} + }, + {name: "The Shanty", loc: {type: "Point", coordinates: [40.7185752, -73.9510538]}}, + { + name: "The Counting Room", + loc: {type: "Point", coordinates: [40.7209601, -73.9588041]} + }, + { + name: "Kinfolk 94", + loc: {type: "Point", coordinates: [40.7217058, -73.9605489]} + } ]; writableCollection.insertMany(locDocs); }, exec: function(readableCollection) { - var res = readableCollection.find({loc: {$near: { - $geometry: { - type: "Point", - coordinates: [40.7211404, -73.9591494] - }}}}).limit(1).toArray(); + var res = readableCollection.find({ + loc: + {$near: {$geometry: {type: "Point", coordinates: [40.7211404, -73.9591494]}}} + }).limit(1).toArray(); assert.eq(res[0].name, "The Counting Room"); } }; |