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的更多相关文章

  1. 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 ...

  2. MongoDB - Introduction of the mongo Shell

    Introduction The mongo shell is an interactive JavaScript interface to MongoDB. You can use the mong ...

  3. Install MongoDB on Windows

    Overview Use this tutorial to install MongoDB on a Windows systems. PLATFORM SUPPORT Starting in ver ...

  4. Install MongoDB on Windows (Windows下安装MongoDB)

    Install MongoDB on Windows Overview Use this tutorial to install MongoDB on a Windows systems. PLATF ...

  5. MongoDB DBA 实践1-----Windows

    一.先决条件 1.支持的平台 在3.4版中更改: MongoDB不再支持32位x86平台. MongoDB需要x86-64架构并支持以下内容: Windows 7 / Server 2008 R2 W ...

  6. laravel 连接mongodb

    In this article we will see how to use MongoDB with Laravel (PHP framework). So first we need to ins ...

  7. openstack Icehouse发布

    OpenStack 2014.1 (Icehouse) Release Notes General Upgrade Notes Windows packagers should use pbr 0.8 ...

  8. lavarel mongo 操作

    本人使用环境   Ubuntu 18.04 LTS php7.2 lavarel5.5 mongodb的安装 mongodb 服务的安装   这个链接中有最全面最新的安装文档 https://docs ...

  9. NoSQLUnit

    NoSQLUnit Core Overview Unit testing is a method by which the smallest testable part of an applicati ...

随机推荐

  1. 无需知道类名,就可以启动apk

    查看官方文档,发现这样一个方法: public abstract Intent getLaunchIntentForPackage (String packageName) 这个方法名就说明:根据包名 ...

  2. java的get请求

    package com.huazhu; import java.io.BufferedReader; import java.io.IOException; import java.io.InputS ...

  3. C++: I/O流详解(三)——串流

    一.串流 串流类是 ios 中的派生类 C++的串流对象可以连接string对象或字符串 串流提取数据时对字符串按变量类型解释:插入数据时把类型 数据转换成字符串 串流I/O具有格式化功能 例: #i ...

  4. 转【C#调用DLL的几种方法,包括C#调用C\C++\C#DLL】

    C#中dll调用方法   一.      DLL与应用程序 动态链接库(也称为DLL,即为“Dynamic Link Library”的缩写)是Microsoft Windows最重要的组成要素之一, ...

  5. 前端的异步解决方案之Promise和Await-Async

    异步编程模式在前端开发过程中,显得越来越重要.从最开始的XHR到封装后的Ajax都在试图解决异步编程过程中的问题.随着ES6新标准的出来,处理异步数据流的解决方案又有了新的变化.Promise就是这其 ...

  6. P4718 【模板】Pollard-Rho算法

    题面 传送门 题解 题解 太神仙了学不来orz //minamoto #include<bits/stdc++.h> #define R register #define ll long ...

  7. k-sum 问题

    问题描述 给定一个数组及数字 k ,从数组中找出所有相加结果为 k 的组合. 示例: 给定数组 [1,1,1] 令 k=2,输出: [[1,1]] 给定数组 [10, 1, 2, 7, 6, 1, 5 ...

  8. python内存相关问题

    想要弄清楚内存相关的问题,就要理清楚:变量.内存地址.值之间的关系:1.程序里什么时候分配新的内存地址?答:1.定义一个变量,内存就开辟一个内存空间,分配一个内存地址. 特殊: 如:a=687 a=1 ...

  9. javascript的最重要的特性之一:闭包的解决方案

    初始代码: for (var j = 0; j < lnglats.length; j++) { AMap.event.addListener(markers[j], 'mouseover', ...

  10. ListItemType.AlternatingItem 和 ListItemType.Item

    项目中后台绑定Reapter项时,判断 if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.Alte ...