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 ...
随机推荐
- python3 线程池-threadpool模块与concurrent.futures模块
多种方法实现 python 线程池 一. 既然多线程可以缩短程序运行时间,那么,是不是线程数量越多越好呢? 显然,并不是,每一个线程的从生成到消亡也是需要时间和资源的,太多的线程会占用过多的系统资源( ...
- Innodb引擎简介
一.锁 二.什么情况出现阻塞 1.频繁更改的表,出现了慢查询 2.频繁访问的表,出现了备份等(表级锁) 三.查看运行情况 show engine innodb status; 四.关键参数 innod ...
- 6.4 C++提取子字符串及字符串的比较
参考:http://www.weixueyuan.net/view/6393.html 总结: 函数substr可以提取string字符串中的子字符串,该函数有两个参数,第一个参数为需要提取的子字符串 ...
- JavaScript+CSS+DIV实现下拉菜单示例
<!DOCTYPE html> <html> <head> <title>下拉菜单示例</title> <script languag ...
- SharePoint REST API - 列表和列表项
博客地址:http://blog.csdn.net/FoxDave 本篇主要讲述如何用SharePoint REST操作列表和列表项.阅读本篇时请先了解前面讲述的REST介绍和基本操作. 废话不多 ...
- python23的区别-日常记录
1. xrange:python3 中取消了range函数,把python2中的xrange重新命名为range,所以在python3中直接用range就行. 2. print:python3中pri ...
- python3.6 安装第三方库 pyCryptodome 实现AES加密
起因 前端日子写完的Python入库脚本,通过直接读取配置文件的内容(包含了数据库的ip,数据库的用户名,数据库的密码),因为配置文件中的数据库密码是明文显示的,所以不太安全,由此对其进行加密. 编码 ...
- L256 翻译
Should work be placed among the causes of happiness or be regarded as a burden? Much work isexceedin ...
- Linux 添加程序图标到开始菜单中
Linux平台的Ubuntu系统中,开始菜单中的程序都在/usr/share/applications/目录下,文件格式都是xxxx.desktop ========================= ...
- Eclipse的配置
1 Eclipse的工作空间和新建工程 1.1: 工作空间 其实就是我们写的源代码所在的目录 1.2: 创建工程(项目) 右键/Package Explore 空白区/new /Java Projec ...