Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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

How to add spatial indexes then?

share|improve this question
    
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? –  Jim Thio 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. –  Jim Thio Aug 14 '12 at 13:34
add comment

1 Answer

up vote 3 down vote accepted

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

share|improve this answer
    
I know database and collection. What is name space? –  Jim Thio 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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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