V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐工具
RoboMongo
推荐书目
50 Tips and Tricks for MongoDB Developers
Related Blogs
Snail in a Turtleneck
chu8129
V2EX  ›  MongoDB

关于 count 和 find 数据总量不一致;

  •  
  •   chu8129 · 2016-04-29 10:37:59 +08:00 · 4011 次点击
    这是一个创建于 2918 天前的主题,其中的信息可能已经有所发展或是发生改变。

    本来想用来储存代理使用的,但是测试的时候发现 count ()结果和 find ()结果不一致;完全是按默认配置启动的。。。有伙伴知道这是为什么吗?

    >use qwdb
    switched to db qwdb
    > db.allproxy.count()
    4
    > db.allproxy.find()
    { "_id" : ObjectId("5722013dcad6d46aa6e02762"), "proxy" : "127.0.0.1:8129" }
    { "_id" : ObjectId("57220271cad6d46aa6e02763"), "proxy" : "127.0.0.1:8080" }
    > db.allproxy.find().count()
    4

    3 条回复    2016-04-29 16:41:00 +08:00
    BOYPT
        1
    BOYPT  
       2016-04-29 10:42:42 +08:00
    db.allproxy.find().explain("allPlansExecution")
    看看
    mongost3t
        2
    mongost3t  
       2016-04-29 15:18:02 +08:00
    mongo find 是个 cursor ,默认不会显示所有的结果……
    aiver
        3
    aiver  
       2016-04-29 16:41:00 +08:00
    find 默认在 shell 下不会显示所有结果的,便于优化显示,和你在程序里面调用接口是不一样的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4640 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 04:03 · PVG 12:03 · LAX 21:03 · JFK 00:03
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.