zoukankan      html  css  js  c++  java
  • mongodb的shell脚本

    #################

    重定向输入mongo脚本:

    #! /bin/bash
     
    mongo --username root  --password 123456 --host 10.10.10.10 --port 27017 --authenticationDatabase admin <<EOF
    use apple;
    db.currentOp();
    EOF

    转义$:

    shell中使用mongodb的时候,如果需要查询条件$,则需要转义$,因为$字符在shell中是变量的意思:

    #! /bin/bash
     
    mongo --username root  --password 123456 --host 10.10.10.10 --port 27017 --authenticationDatabase admin <<EOF
    use apple;
    print("该实例上的连接数情况:db.serverStatus().connections;");
    db.serverStatus().connections;
    print("===========================");
    db.currentOp({ "desc" :{$nin: ["rsSync-0","ReplBatcher","monitoring keys for HMAC","WT OplogTruncaterThread: local.oplog.rs","NoopWriter"]}});
    EOF

    ###################

    igoodful@qq.com
  • 相关阅读:
    mybatis plus 执行sql
    springboot 打印 mybatisplus 的sql
    easyexcel 简单使用
    springboot ehcache
    easyexcel 时间转换
    springboot stopwatch
    c# 开机自动启动
    sqlHelper
    DirectX录音
    c# 发邮件
  • 原文地址:https://www.cnblogs.com/igoodful/p/14314497.html
Copyright © 2011-2022 走看看