Best approaching for adding custom Indexes?

So, everything is quite simple, modify your attribute in /models/{name}.settings.json

"location": {
      //add this one
      "index":"2dsphere"
    }

Note: "index":true adds the regular ascending index, this is why your manually created 2dsphere was deleted during bootstrap.

Available methods for indexes (only for MongoDB!):

 "index":1      // will create regular ascending index
 "index":-1     // will create regular descending index
 "index":"2dsphere"   // will create 2dphere index

Result:

image

2 Likes