title: mongodb check if point is in polygon
body: <p><code>mongo 2.6</code></p>
  
  <p>I have some amount of stored polygons. And I have a point. I what to know if this point fits any of stored polygons</p>
  
  <p>document example</p>
  
  <pre><code>{ ..., "polygons" : [ [ 17.60083012593064, 78.18557739257812 ], [ 17.16834652544664, 78.19381713867188 ], [ 17.17490690610013, 78.739013671875 ], [ 17.613919673106714, 78.73489379882812 ] ], ... }
  </code></pre>
  
  <p>There is nearly the same question already <a href="https://stackoverflow.com/questions/15866490/mongodb-check-if-a-point-is-inside-a-stored-polygon">Mongodb : Check if a point is inside a stored polygon</a>.
  But it is not working for me - this query has to give at least one result(the one in example) - but it does not. </p>
  
  <pre><code>db.areas.find( { polygons : { $geoIntersects : { $geometry : {type:"Point",coordinates:[17.3734, 78.4738]} } } } )
  </code></pre>
  
  <p>Actually if I chose a point on a border of any polygon - it does.</p>
  
  <p><code>$geoWithin</code> method has to do the work as <code>mondodb</code> documentation says. </p>
  
  <p>but any of these queries do not work</p>
  
  <pre><code>db.areas.find( { polygons : { $geoWithin : { $geometry : {type:"Point",coordinates:[17.3734, 78.4738]} } } } ) - not supported with provided geometry
  
  db.tradeareas.find( { polygons : { $geoWithin : { $geometry : {type:"Polygon",coordinates: inside_polygon} } } } ) - BadValue bad geo query
  </code></pre>
  
  <p>It seems I miss something but cant understand what and where.</p>
  
  <p>I would be grateful for help.</p>