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 ...
随机推荐
- 《Head First Servlets & JSP》-3-1st servlet MVC demo
项目结构 用户首页 form.html <html> <body> <h1 align='center'>Beer Selection Page</h1> ...
- Java50道经典习题-程序46 字符串连接
题目:编写一个两个字符串连接的程序 import java.util.Scanner; public class Prog46 { public static void main(String[] a ...
- 关于webapi练习过程中遇到的一系列问题记录
最近在尝试本地进行webapi调用的过程中,遇到一系列的问题,demo很小但着实让人头疼,先附上demo. 前台页面,目的是展示新闻的分类: 类别模型如下: 控制器代码如下: public Actio ...
- C#之WinForm界面分辨率问题
在做上一个C#小工具的时候,当时为了处理界面最大化,分辨率问题,只是简单的用各种···Panle控价简单随意的处理控件的大小位置,字体什么的就随缘了(貌似有点不负责任啊,嘿嘿~). 所以在开始第二个C ...
- 一道面试题关于js中添加动态属性
js中数据类型包含基本数据类型和引用类型,基本类型包括:string.null.undefined.number.boolean.引用类型即是对象比如:array .function以及自定义对象等 ...
- 视图view没有主键,但可以添加唯一索引
视图没有主键,但可以加上唯一索引 大致可以这样理解:视图是张虚拟的表.视图所对应的数据不进行实际的存储,数据库中只存储视图的定义,对视图的数据进行操作时,系统根据视图的定义去操作与视图相关联的基本表. ...
- [51nod1238] 最小公倍数之和 V3(杜教筛)
题面 传送门 题解 懒了--这里写得挺好的-- //minamoto #include<bits/stdc++.h> #define R register #define ll long ...
- 8、OpenCV Python 图像直方图
__author__ = "WSX" import cv2 as cv import numpy as np from matplotlib import pyplot as pl ...
- luogu1900 自我数
分享一个非正解的做法 本题解内存最低(\(\le1\rm MiB\)) 但是不开O2会tle 思路:每个数字仅会更新出1个新的数字,而且这个新数字比旧数字最多也就大70多.所以这里还是利用" ...
- 【NOIP 2009】靶形数独
题目描述 小城和小华都是热爱数学的好学生,最近,他们不约而同地迷上了数独游戏,好胜的他们想用数独来一比高低.但普通的数独对他们来说都过于简单了,于是他们向 Z 博士请教,Z 博士拿出了他最近发明的“靶 ...