How to create a 2DSphere index on a array of locations?

791 views Asked by At

I Have this collection :

{
  geopositions: [
          {type:"Point", coordinates: [-10, 12]},
          {type:"Point", coordinates: [-25, 85]}
     ]
}

but when i try to create the 2DSphere index on geopositions with db.myCollection.createIndex( {"geopositions": "2dsphere"} ); I receive an error (Can't extract geo keys). How can i create my 2DSphere index ?

0

There are 0 answers