RailsSon
RailsSon

Reputation: 20647

Adding index to MongoDB causes empty results

I have a mondoDB with data in it at the moment which I am querying with Ruby on Rails. I am looking to index the database to speed things up a bit.

I read the mongoDB documentation and followed the instructions on how to add a index, like so:

db.collection.ensureIndex({"key": 1})

This returns true and returns this in the console:

building new index on { key: 1.0 } for db.collection...done for 10192 records

However, when I go back to the Ruby on Rails application no results are return and when I drop the indexes everything returns back to normal.

Does anyone know why this might be happening.

Cheers

Eef

Upvotes: 1

Views: 408

Answers (1)

dm.
dm.

Reputation: 2002

more info would help such as some output from the shell with the query, its output, ensureindex, then query output again, and detailed version #s

you can get help in http://groups.google.com/group/mongodb-user or on the IRC channel

Upvotes: 2

Related Questions