Most of my slow queries on my server are due to a single find query. I have a collection that represents website pages. I want to be able to look up a page in the collection by URL. The caveat is that a website might have URLs that redirect to it.I've modeled my schema (with Node.js/Mongoose) like this:{        'url':                      { type: String, index: {unique: true, dropDups: true} },        'redirects':                { type: Array, index: true },        // ... other stuff    }In other words, one entry might have the URL http://codereview.stackexchange.com/ but also have an array of 5 other URLs (such as bit.ly URLs) that redirect to it.Later, I want to query the collection to see if we have an entry which matches an arbitrary set of URLs. I don't know if the URLs are redirected URLs or what -- I just want to find all matches in my collection that represent these URLs.So I do this:// urls is an array of URL strings we want to find...model.find({$or: [{'url': {$in: urls}}, {'redirects': {$in: urls}}]}).lean().exec( ... );Unfortunately, I might be looking for around 200 URLs at once, so this query sometimes takes > 1 second.Is there further optimization I can do, or would it be better to split the query into multiple queries, capping the search-size each time?
Query for finding collection entries matching an arbitrary set of URLs
javascript;node.js;mongodb