Here is the query in the Rails console:
database=application_database collection=posts selector={"merchant_id"=>"51c3a84b9727911738000003", "status"=>{"$nin"=>["10", "8"]}, "admin_id"=>{"$nin"=>[nil, "0"]}, "start_date"=>{:$gte=>2014-12-26 06:00:00 UTC}, "end_date"=>{:$lte=>2015-01-02 06:00:00 UTC}} flags=[:slave_ok] limit=0 skip=0 batch_size=nil fields=nil (45.3529ms)
Can anyone recommend a way to better optimize this query ? I have an index for this particular query:
{
"v" : 1,
"key" : {
"merchant_id" : 1,
"admin_id" : 1,
"start_date" : 1,
"status" : 1
},
"name" : "merchant_id_1_admin_id_1_start_date_1_status_1",
"ns" : "application_database.posts",
"background" : true
}
But it's still taking longer to dip this than it is to render the enter view file for the customers (28 ms just for the view). I'd like to provide a better experience to our customers.