zoukankan      html  css  js  c++  java
  • 测试工作中用到的MongoDB命令

    1.远程连接MongoDB

    mongo host:port/dbname (host和port根据自己需要修改)

    连接成功页面如下:

    2.显示所有数据库

    show dbs

    3.切换到oversea-allo数据库

    use oversea-allo

    4.显示oversea-allo数据库下所有集合

    show collections

    5.查询operUid=70005440和operUid=70005441的房间和麦上时长记录

    db.user_mic.find({ $or : [{ $and : [{"operUid" : 70005440}, { $or : [{"type" : 1}, {"type" : 2}] }] }, { $and : [{"operUid" : 70005441}, { $or : [{"type" : 1}, {"type" : 2}] }] }] }).limit(1000).skip(0)

    等价效果:

    6.修改operUid=70005440的开始时间

    db.user_mic.update({"operUid":70005440,"type":1},{$set:{"beginTime":1575201600000}})

    7.删除operUid=70005441的房间时长记录

    db.user_mic.remove({"operUid":70005441,"type":1})

    8.删除operUid=70005441的房间和麦上时长记录

    db.user_mic.remove({"operUid":70005441,$or:[{"type":1},{"type":2])

  • 相关阅读:
    tf.get_variable
    tf.Variable
    tf.placeholder
    conda命令详解
    linux查看程序运行时占用的内存
    ubuntu安装openssh-server
    sed命令
    二分查找
    vue简单使用
    斐波那契数列求解
  • 原文地址:https://www.cnblogs.com/wanyuan/p/12061299.html
Copyright © 2011-2022 走看看