开发者

Query for a non existing key in a big scale mongoDB database

开发者 https://www.devze.com 2023-03-09 00:14 出处:网络
I\'m testing a little bit with mongoDB. I\'ve created a database with a high amount of data (approx 5 million documents). When I start a query for a non existing key, it will take a lot of time. I\'ve

I'm testing a little bit with mongoDB. I've created a database with a high amount of data (approx 5 million documents). When I start a query for a non existing key, it will take a lot of time. I've tried to stop the query but db.curre开发者_JS百科ntOp() doesn't show a operation so I don't know how to stop the query.

Cheers Sven


You can try $maxScan operator to limit items scanned:

db.foo.find()._addSpecial( "$maxScan" , 50 )

http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-Specialoperators

0

精彩评论

暂无评论...
验证码 换一张
取 消