title: MongoDB geospatial query with $not
body: <p>I have a basic geospatial query working well in MongoDB. It seems that it should be easy to apply $not to get the complement... but it's not working for me. Is it simple user error? Or can MongoDB not handle this query conceptually? I could not find any such limitation in the <a href="http://www.mongodb.org/display/DOCS/Geospatial+Indexing">documentation</a>.</p>
  
  <p>Working query (correctly finds the 2 cities within 10 miles of the center):</p>
  
  <pre><code>db.customers.find({ "location" : { $within : { $center : [[-117.15,32.72],0.15] } } })
  </code></pre>
  
  <p>Attempted complement query (desired result is the 1 city that is not within 10 miles):</p>
  
  <pre><code>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
  }
  </code></pre>
  
  <p>For anyone that wants to copy/paste the query to see the error, here's a tiny bit of sample data:</p>
  
  <pre><code>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]})
  </code></pre>
  
  <p>(I'm using MongoDB 1.8.2 in case that matters.)</p>