5
function test(indexname) {
6
assert.eq(1, t.find({lon_lat: [-71.34895, 42.46037]}).itcount(), indexname);
7
t.ensureIndex({lon_lat: indexname, population: -1})
8
assert.eq(2, t.find({lon_lat: {$nearSphere: [-71.34895, 42.46037]}}).itcount(), indexname);
9
assert.eq(1, t.find({lon_lat: [-71.34895, 42.46037]}).itcount(), indexname);
10
t.dropIndex({lon_lat: indexname, population: -1})
13
t.insert({ city: "B", lon_lat: [-71.34895, 42.46037], population: 1000})
14
t.insert({ city: "A", lon_lat: [1.48736, 42.55327], population: 100})