Mongodb installation & userguide
1.Mongodb Installation in Ubuntu
(1) Download from: https://www.mongodb.org/downloads
File: mongodb-linux-x86_64-ubuntu1404-3.0.6.tgz
(2) Decompressing files.
tar zxf mongodb-linux-x86_64-ubuntu1404-3.0.6.tgz
mv mongodb-linux-x86_64-ubuntu1404-3.0.6 /usr/local/mongodb
(3) Create default directories for mongdb data files.
mkdir data
cd data
mkdir db
(4) Create default logs file.
touch logs
(5) Run mongod.
--fork fork server process
--dbpath arg directory for datafiles - defaults to /data/db
--logpath arg log file to send write to instead of stdout - has to be a file, not directory
--httpinterface enable http interface
cd bin
./mongod --dbpath=/usr/local/mongodb/mongodb/data/db --fork --httpinterface --logpath=/usr/local/mongodb/mongodb/logs
(6) Check mongod process.
ps -ef | grep mongo
(7) Check mongodb information.
http://192.168.98.70:28017/
(8) Enter mongo shell.
cd bin
./mongo
MongoDB shell version: 3.0.6
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
2.Use Mongodb.
show dbs show database names
show collections show collections in current database
show users show users in current database
show profile show most recent system.profile entries with time >= 1ms
show logs show the accessible logger names
show log [name] prints out the last segment of log in memory, 'global' is default
use <db_name> set current database
db.foo.find() list objects in collection foo
db.foo.find( { a : 1 } ) list objects in foo where a == 1
it result of the last line evaluated; use to further iterate
DBQuery.shellBatchSize = x set default number of items to display on shell
exit quit the mongo shell
3.CRUD.
db.foo.insert({name:'edison',age:28})
db.foo.insert({name:'scofield',age:30})
db.foo.find()
db.foo.find({name:'edison'})
db.foo.update({name:'edison'},{name:'edison',age:40})
db.foo.remove({age:40})
Mongodb installation & userguide的更多相关文章
- Recovering a WiredTiger collection from a corrupt MongoDB installation
Reference: http://www.alexbevi.com/blog/2016/02/10/recovering-a-wiredtiger-collection-from-a-corrupt ...
- MongoDB - Introduction of the mongo Shell
Introduction The mongo shell is an interactive JavaScript interface to MongoDB. You can use the mong ...
- Install MongoDB on Windows
Overview Use this tutorial to install MongoDB on a Windows systems. PLATFORM SUPPORT Starting in ver ...
- Install MongoDB on Windows (Windows下安装MongoDB)
Install MongoDB on Windows Overview Use this tutorial to install MongoDB on a Windows systems. PLATF ...
- MongoDB DBA 实践1-----Windows
一.先决条件 1.支持的平台 在3.4版中更改: MongoDB不再支持32位x86平台. MongoDB需要x86-64架构并支持以下内容: Windows 7 / Server 2008 R2 W ...
- laravel 连接mongodb
In this article we will see how to use MongoDB with Laravel (PHP framework). So first we need to ins ...
- openstack Icehouse发布
OpenStack 2014.1 (Icehouse) Release Notes General Upgrade Notes Windows packagers should use pbr 0.8 ...
- lavarel mongo 操作
本人使用环境 Ubuntu 18.04 LTS php7.2 lavarel5.5 mongodb的安装 mongodb 服务的安装 这个链接中有最全面最新的安装文档 https://docs ...
- NoSQLUnit
NoSQLUnit Core Overview Unit testing is a method by which the smallest testable part of an applicati ...
随机推荐
- Zinterstore 命令
先来看一下这个命令的定义: Redis Zinterstore 命令计算给定的一个或多个有序集的交集,其中给定 key 的数量必须以 numkeys 参数指定,并将该交集(结果集)储存到 destin ...
- Sqlserver根据条件去除重复数据并且留下的是最大值数据
项目中需要根据条件获取一些数据,但是如果条件相同的情况下,要去掉条件一样的并且某个值是最小的数据,留下的是最大值数据. 简单记录一下sql: --去重保留最大值那条 --Year和MCode一样的前提 ...
- 根据GridView模板里的列名获取列索引
以前Insus.NET在写过一篇<在Gridview控件中根据Field Name来取得对应列索引> http://www.cnblogs.com/insus/archive/2010/0 ...
- Java编程思想读书笔记之一切皆对象
一切皆对象 Java程序运行时,数据保存到哪里 寄存器 这是最快的保存区域,因为它位于和其他所有保存方式不同的地方:处理器内部.然而,寄存器的数量十分有限,所以寄存器是根据需要由编译器分配.我们对此没 ...
- 「BZOJ 1297」「SCOI 2009」迷路「矩阵乘法」
题意 边权\(w \in [1, 9]\)的\(n\)个结点的有向图,图上从\(1\)到\(n\)长度为\(d\)的路径计数,\(n \leq 10\). 题解 如果边权为\(1\)很经典,设\(f[ ...
- 【转】ROWNUM与ORDER BY先后关系
源地址:http://www.cnblogs.com/accumulater/p/6137385.html
- soj 131 找题
soj 131 找题 给出两个长度为n,都含k个1的字符串A,B.现在令\(a_1,a_2,\dots,a_k\)是A中1的下标,\(b_1,b_2,\dots,b_k\)是B中1的下表,然后将a,b ...
- LinkedList实现原理
原文链接:https://www.jianshu.com/p/56c77c517e71 本文对LinkedList的实现讨论都基于JDK8版本 Java中的LinkedList类实现了List接口和D ...
- P2866 [USACO06NOV]糟糕的一天Bad Hair Day
题意:给你一个序列,问将序列倒过来后,对于每个点,在再碰到第一个比它大的点之前,有多少比它小的? 求出比它小的个数的和 样例: 610374122 output: 5 倒序后:2 12 4 ...
- Xcode的编辑利器Xvim,如何去掉烦人工具栏和文件路径
最近网上看到了一篇关于Xcode的编辑利器,因为以前做FPGA工作时候在ISE SDK下用过vim作为编辑器,所以深知vim的强大,所以安装Xvim: 在安装之后遇到一些配置问题,因为本来就完美控制, ...