V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐工具
RoboMongo
推荐书目
50 Tips and Tricks for MongoDB Developers
Related Blogs
Snail in a Turtleneck
chu8129
V2EX  ›  MongoDB

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

  •  
  •   chu8129 · Apr 29, 2016 · 4901 views
    This topic created in 3658 days ago, the information mentioned may be changed or developed.

    本来想用来储存代理使用的,但是测试的时候发现 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 replies    2016-04-29 16:41:00 +08:00
    BOYPT
        1
    BOYPT  
       Apr 29, 2016
    db.allproxy.find().explain("allPlansExecution")
    看看
    mongost3t
        2
    mongost3t  
       Apr 29, 2016
    mongo find 是个 cursor ,默认不会显示所有的结果……
    aiver
        3
    aiver  
       Apr 29, 2016
    find 默认在 shell 下不会显示所有结果的,便于优化显示,和你在程序里面调用接口是不一样的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   985 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 23:17 · PVG 07:17 · LAX 16:17 · JFK 19:17
    ♥ Do have faith in what you're doing.