high query target with compound-index Mongodb

43 views Asked by At

I have tried to create a compound-index on Mongodb. But what ever I try I have a query-target 1000-1500, and it are only 1000-2000 documents for this id.

localdb[db][collection].find({"eventid":id,"maxmoneyline":lastlimit}).sort("time",-1).limit(60)
[
        {
                "v" : 2,
                "key" : {
                        "_id" : 1
                },
                "name" : "_id_",
                "ns" : "3.6227"
        },
        {
                "v" : 2,
                "key" : {
                        "eventid" : 1,
                        "maxmoneyline" : 1,
                        "time" : -1
                },
                "name" : "eventid_1_maxmoneyline_1_time_-1",
                "ns" : "3.6227"
        }
]

I hope you can help me, tried everything. just index eventid has same query-target of around 1000

thanks

1

There are 1 answers

0
NamuroD On

Index works 100%.

Problem was I not had the index on every Collection I used this query for.