we've meet with really weird problem. Our simple queries to MongoDB takes really long time to return any document. Database is well indexed. We've made few tests and here they are:
File.find({sharename: '7iPJUtP2'}, function(err, shares){
console.log(err,shares);
});
console.log fires after 60s.
Then we use .native() method:
File.native(function(err, collection){
collection.find({sharename: '7iPJUtP2'}, {})
.toArray(function (err, results) {
console.log(err,results);
});
});
Here console.log fires in 103ms.
The stack we use is:
- sails: 0.11.0
- sails-mongo: 0.11.5
- MongoDB: 2.0.1
- Waterline: 0.10.28
Can someone help with this issue?
Update
File.find({sharename: '1'}) executes in 50ms.
File.find({sharename: 'a'}) executes in 18000ms.
Documents are identical except of sharename field.