
Untitled
By: a guest on
May 22nd, 2012 | syntax:
None | size: 0.68 KB | hits: 14 | expires: Never
MongoDB geospatial query with $not
db.customers.find({ "location" : { $within : { $center : [[-117.15,32.72],0.15] } } })
db.customers.find({ "location" : { $not : { $within : { $center : [[-117.15,32.72],0.15] } } } })
error: {
"$err" : "missing geo field (location) in : {location: { $not: { $within: { $center: [ [ -117.15, 32.72 ], 0.15 ] } } } }",
"code" : 13042
}
db.customers.ensureIndex( { "location" : "2d" } )
db.customers.save({"city":"La Mesa","state":"CA","location":[ -117.02,32.76 ]})
db.customers.save({"city":"Chula Vista","state":"CA","location":[ -117.08,32.63 ]})
db.customers.save({"city":"Mexico City","state":"Mexico","location":[-99.133244,19.4326]})