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 ...
随机推荐
- maven项目配置findbugs插件 使用git钩子控制代码的提交
maven项目配置findbugs插件对代码进行静态检测 当发现代码有bug时,就不让用户commit代码到远程仓库里 没有bug时才可以commit到远程仓库中 (1)新建maven项目 ,配置fi ...
- C++标准库头文件名字和C语言头文件名字的区别
1.C++版本的C标准库头文件,一般是cname,而C语言头文件一般是name.h 2.命名为cname的头文件中定义的名字都是从std中来的,而如果是name.h则不是这样的. 3.与是用name. ...
- :单件模式:Singleton
#ifndef __SINGLETON_H__ #define __SINGLETON_H__ class Singleton { private: static Singleton* instanc ...
- html、xhtml、html5的区别
1.HTML:HyperText Mark-up Language(超文本标记语言)构成网页的主要语言 常指:HTML 4.012.XHTLM:EXtensible HyperText Mark-u ...
- 6.3 C++修改字符串
参考:http://www.weixueyuan.net/view/6392.html 总结: string字符串同样可以像字符串数组那样按照下标逐一访问字符串中的每一个字符,string字符串的起始 ...
- Linux文件管理常用命令用法总结
1.touch change file timestamps. 命令用于修改文件或者目录的时间属性,包括存取时间和更改时间.若文件不存在,系统会建立一个新的文件.stat,ls -l 可以显示档案的时 ...
- translclude
.transclude:true 启用transclude,启用以后,有两个地方会发生变化: ①.使用指令的元素内部的所有内容都会被保存起来.不妨先把这一段内容称为一坨. 比如指令元素是这样的: &l ...
- 201621123001《Java程序设计》第5周学习总结
1.本周学习总结 1.1 写出你认为本周学习中比较重要的知识点关键词 Answer: 本周重要关键词有接口,Comparator接口,Comparable接口,interface关键字,抽象类等. 1 ...
- netty pipeline.addLast
pipeline有一个主要的实现类 DefaultChannelPipeline ,addLast顾名思义,就是在处理器链的最后添加一个channelHandler. 代码如下:@Override ...
- Tensorflow函数:tf.zeros
tf.zeros函数 tf.zeros( shape, dtype=tf.float32, name=None ) 定义在:tensorflow/python/ops/array_ops.py. 创建 ...