In rockmongo we got fields for the field name and whether we should sort by ascending or descending.

How to add spatial indexes then?

  • Have you seen this? mongodb.org/display/DOCS/Geospatial+Indexing – dezso Aug 14 '12 at 12:36
  • I have. That's not rockmongo. That's command line. I want something where I am less likely to make mistake. I suppose I can run command line in rockmongo do I? – user4951 Aug 14 '12 at 13:32
  • Actually I read a book about it. I want convenience. When that fails, I'll do it the command line way. – user4951 Aug 14 '12 at 13:34

From what I can see, RockMongo does not support the creation of geo indexes directly. Because creating an index is really just an insert into the system.indexes collection for the database (ensureIndex is just a shell helper), it is possible. So, you can still do it via RockMongo, but it is arguably more complicated than using the CLI.

Here is how I successfully added a Geo index via RockMongo:

  1. Go to the system.indexes collection of the parent database (foo in my case)
  2. Insert the following document:

    { "v": 1, "key": { "loc": "2d" }, "ns": "foo.geotest", "name": "loc_" }

Substitute the name of the field ("loc" above), the index name ("loc_" above) and the namespace ("foo.geotest" above) as appropriate.

In order to add a field to specify the index type, you are going to have to make a feature request in the project I would think - there is nothing obviously similar currently open:


  • I know database and collection. What is name space? – user4951 Aug 15 '12 at 2:28
  • namespace = database.collection (if database is foo, and collection is geotest, namespace is foo.geotest) – Adam C Aug 15 '12 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.