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 ... 
随机推荐
- Java数据结构与算法分析-第一章(引论)-Java中的范型<T,E>构件
			一.为什么需要使用范型? 官方的说法是:Java 泛型(generics)是 JDK 5 中引入的一个新特性, 泛型提供了编译时类型安全检测机制,该机制允许程序员在编译时检测到非法的类型. 泛型的本质 ... 
- C#中的多线程 - 高级多线程
			1非阻塞同步Permalink 之前,我们描述了即使是很简单的赋值或更新一个字段也需要同步.尽管锁总能满足这个需求,一个存在竞争的锁意味着肯定有线程会被阻塞,就会导致由上下文切换和调度的延迟带来的开销 ... 
- 安卓手机牛逼软件Termux中安装Archlinux,安装Jdk
			说出来你可能不信,手机上居然装了两个linux系统,和真实的linux有些许些差别. 首先安装了Termux以后你发现,好多linux常用功能都有,什么Pyhton,gcc,g++,ruby,Php, ... 
- 转载 NoSQL | Redis、Memcache、MongoDB特点、区别以及应用场景
			NoSQL | Redis.Memcache.MongoDB特点.区别以及应用场景 2017-12-12 康哥 码神联盟 本篇文章主要介绍Nosql的一些东西,以及Nosql中比较火的三个数据库Red ... 
- (multi)set的某些操作
			(multi)set的某些操作 我们可以把multiset当作平衡树用~ 注意,必须定义小于运算符. s.begin() 返回指向第一个元素的迭代器. s.end() 返回指向最后元素的后面那个虚拟元 ... 
- shell操作字符串案例
			#!/bin/bash name="Shell" url="http://cxy.com/" str1=$name$url #中间不能有空格 str2=&quo ... 
- POJ1063 Flip and Shift
			题目来源:http://poj.org/problem?id=1063 题目大意: 有一种游戏如图所示.一个填满黑白球的转盘,它可以有两种操作,一种是将大转盘顺时针旋转,所有球的位置顺时针挪一位,另一 ... 
- Unity 动画系统 AnimationEvent 动画事件
- CodeForces-Zuhair and Strings(思维+枚举)
			Given a string ss of length nn and integer kk (1≤k≤n1≤k≤n). The string ss has a level xx, if xx is l ... 
- 表格排序插件datatables
			之前用过表格排序插件tinytables,用到后面,随着需求的更改,发现这个插件真的low到爆了,不适合用于多表格,只有一个表格的页面可以凑合着用,有很多局限性. 之后发现了一款表格排序插件datat ... 
