基础 1.查看所有数据库: show dbs 2.选择数据库: use test 3.查看数据库中有哪些集合: show collections 如下图: 查询 1.查看集合中有哪些数据,其中abc为集合名称: 2.为查询添加过滤条件a=2: 3.指定查询结果集中包含的字段,如下查询仅包含字段a/b,注意,此处除了_id字段外,其他字段要么全是1,要么全是0: 4.综合示例: db.kpiRecord.find( { cellCode:"48BF74_12020000051TST0001&quo
最近有在学习MongoDB,看到了关于Map-Reduce,觉得蛮有意思的,所以在这里就记录下来作为学习笔记. 关于Map-Reduce的作用这里就引用一下官网以及另外一篇文章看到的,言简意赅. 1. 官网:http://docs.mongodb.org/manual/tutorial/map-reduce-examples/ The map-reduce operation is composed of many tasks, including: reads from the input c
目录 Shell 打印文件的最后5行 题解-awk 题解-tail Shell 打印文件的最后5行 经常查看日志的时候,会从文件的末尾往前查看,于是请你写一个 bash脚本以输出一个文本文件 nowcoder.txt中的最后5行 示例: 假设 nowcoder.txt 内容如下: #include<iostream> using namespace std; int main() { int a = 10; int b = 100; cout << "a + b:&quo
mongo Shell Command History You can retrieve previous commands issued in the mongo shell with the up and down arrow keys. Command history is stored in ~/.dbshell file. See .dbshell for more information. Command Line Options The mongo shell can be sta
MongoDB BSON provides support for additional data types than JSON. Drivers provide native support for these data types in host languages and the mongo shell also provides several helper classes to support the use of these data types in the mongo Java
You can write scripts for the mongo shell in JavaScript that manipulate data in MongoDB or perform administrative operation. For more information about the mongo shell, see the Running .js files via a mongo shell Instance on the Server section for mo
In addition to the documentation in the MongoDB Manual, the mongo shell provides some additional information in its “online” help system. This document provides an overview of accessing this help information. Command Line Help To see the list of opti
Customize the Prompt You may modify the content of the prompt by setting the variable prompt in the mongo shell. The promptvariable can hold strings as well as JavaScript code. If prompt holds a function that returns a string, mongo can display dynam
Introduction The mongo shell is an interactive JavaScript interface to MongoDB. You can use the mongo shell to query and update data as well as perform administrative operations. The mongo shell is a component of the MongoDB distributions. Once you h
当直接执行./mongo 出现这样的提示:couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145 解决: 执行./mongod --dbpath=/data/mong/db 启动后再执行 ./mongo 则可以了