2

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

How to add spatial indexes then?

Adam C
  • 9,235
  • 3
  • 28
  • 45
user4951
  • 1,355
  • 5
  • 20
  • 39

1 Answers1

4

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:

http://code.google.com/p/rock-php/issues/list

Adam C
  • 9,235
  • 3
  • 28
  • 45