I ran a mongodump and then mongorestore to move a MongoDB database from one computer to another. The data are there, I can query them (first query) and get results but using $or in a query produces no results (second query).
db.employees.find( { 'name.first' : 'Joe' })
-- vs --
db.employees.find( { $or : [ { 'name.first' : 'Joe' }]})
As far as I can tell, indexes have been recreated from system.indexes.bson, any ideas what is wrong?
indexes:
> db.employees.getIndexes()
[
{
"name" : "_id_",
"ns" : "data.demployees",
"key" : {
"_id" : 1
}
}
]
- original server: MongoDB 1.6.5 64b
- new server: MongoDB 1.4.4 32b
I was running the query through the console, not pymongo.
To really help here, we need a few pieces of information:
db.employees.getIndexes()Smaller Data Set
Try copying out a small set of the
employeesto a new collection and run the same queries:Basically, let’s try to rule out corruption of data. Then let’s try to isolate the version and see if this is a known bug.
Double-check Data Types
Ensure that the data types are correct.
Is this a bug?
This could be a bug, but if it is, the bug should be trivial to reproduce. Once you’ve double-checked that the system is behaving incorrectly, it’s time to repro this so that you can at least file a bug.