shell excute mongo query command
use shell command
method one:
#!/bin/bash if [ $# -ne ]
then
echo 'Please input cid'
exit
fi
HOST=192.168.1.1: mongo ${HOST}/new_db << EOF
db.camp.findOne({"cId":$});
EOF
method two:
echo"db.mycollection.findOne()" | mongo myDbName
echo"show collections" | mongo myDbName
refer:http://ask.helplib.com/281277
refer: http://www.epubit.com.cn/book/onlinechapter/27994
shell excute mongo query command的更多相关文章
- mongo实践-透过js shell操作mongo
mongo实践-通过js shell操作mongo 保存命令: j={name:"wangjingjing",age:15} db.user.save(j); 查询命令: var ...
- excute和query
query(update goods set is_delete=1 where goods_id=13)总是出错??为什么, excute(update goods set is_delete=1 ...
- Shell脚本出现$'\r': command not found
Centos7下执行shell脚本报错如下 [root@ip---- ~]# sh install_zabbix_agent.sh install_zabbix_agent.: $'\r': comm ...
- jenkins构建执行shell 所有命令出现command not found
出现的问题: + rsync -avzP /mnt/workspace/df-admin/ root@192.168.0.153:/home/deploy/deep_fashion_targets/w ...
- Linux Shell 错误: $'\r': command not found错误解决
在Linux下执行程序最省事的方式就是将系统的执行流程封装成一个shell脚本,上传到linux环境中后就可以直接执行了,但是今天在具体实施的时候出现了错误 $'\r': command not fo ...
- 执行shell脚本出错'\r': command not found
在linux中执行脚本时出错 $'\r': command not found 错误原因是在脚本中有空行,如果脚本是在Windows下进行编辑之后上传到linux上去执行的话,就会出现这个问题. 因为 ...
- [Jenkins] Creating Application builds
After installing the jenkins, we start creating new job. 1. Give job names (your project name): 2. G ...
- MongoDB Shell (mongo)
https://docs.mongodb.com/getting-started/shell/client/ The mongo shell is an interactive JavaScript ...
- MongoDB - The mongo Shell, Write Scripts for the mongo Shell
You can write scripts for the mongo shell in JavaScript that manipulate data in MongoDB or perform a ...
随机推荐
- 【阅读笔记】《C程序员 从校园到职场》第三章 程序的样式(大括号)
参考: https://blog.csdn.net/zhouzhaoxiong1227/article/details/22820533 一..初始化数组变量 在实际的软件开发项目中,变量在使用前应初 ...
- uitableView group模式下的间距问题
我么在使用group模式定义tableview的时候,系统默认是会有head和foot的间距的,来区分我们不同的group:在具体使用的时候又时候我们不需要这个间距.我们可以重新赋值这些间距来达到我们 ...
- (C/C++学习笔记) 二十三. 运行时类型识别
二十三. 运行时类型识别 ● 定义 运行时类型识别(Run-time Type Identification, RTTI) 通过RTTI, 程序能够使用基类的指针或引用来检查(check)这些指针或引 ...
- node 慕课笔记
global global.testVar2 = 200; 在别的文件中可以任意调用到 因为global是全局变量相当于js的window一样的
- L327 找灵魂伴侣
Looking for the Perfect Partner I'm sure we all remember a time when we fell in love. For some it wa ...
- 2019-02-25 EST 科技文翻译
The Definition of Theme and Rheme The point of departure is equally presented to the speaker and to ...
- python sub替换方法
命令:re.sub(pattern, repl, string, count=0, flags=0) re.sub 用于替换字符串的匹配项.如果没有匹配到规则,则原字符串不变. 第一个参数:规则 第二 ...
- python文件读写小结
读文件 打开一个文件用open()方法(open()返回一个文件对象,它是可迭代的): >>> f = open('test.txt', 'r') r表示是文本文件,rb是二进制文件 ...
- React-Native子组件修改父组件的几种方式,兄弟组件状态修改(转载)
子组件修改父组件的状态,在开发中非常常见,下面列举了几种方式.DeviceEventEmitter可以跨组件,跨页面进行数据传递,还有一些状态的修改.http://www.jianshu.com/p/ ...
- C和C++内存模型
以下内容,大部分整理自网络 C分为四个区:堆,栈,静态全局变量区,常量区 C++内存分为5个区域(堆栈全常代 ): 堆 heap : 由new分配的内存块,其释放编译器不去管,由我们程序自己控制(一个 ...