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. javax.servlet.ServletConfig接口(五)

    主要作用是保存web.xml文件里面的配置信息 一个servlet对应一个ServletConfig,100个servlet对应100个ServletConfig.   代码如下(单个获取和获取所有) ...

  2. ElementUI的表单和vee-validate结合使用时发生冲突的解决

    在Vue项目中使用ElementUI表单时,同时又引入了vee-validate进行使用的时候,在浏览器上会出现这样的报错: [Vue warn]: The computed property &qu ...

  3. android studio中退出时弹出对话框

    在app中总是不小心点击了退出怎么办?当然是加个弹出的提示框了,本人新手,就加在主界面上了 @Override public boolean onKeyDown(int keyCode, KeyEve ...

  4. 使用Privoxy转化SSH到HTTP代理

    为什么要进行转换? 一般我们很容易找到通过SOCKS5代理的方法,如SSH,但是很多浏览器或是软件只支持HTTP方式,所以就需要将我们的SSH代理模式转为HTTP代理方式  如何转换? 使用Privo ...

  5. C# console application executing macro function

    C#控制台应用程序,执行或运行Office的宏函数,程序如下: 应用例子:

  6. 转载 MySQL创建表的语句 示例

    show variables like 'character_set_client';#查询字符集 show databases;#列出所有的服务器上的数据库alter create database ...

  7. Redis学习笔记(3)—— 五种数据类型&keys的通用操作

    一.Redis数据结构介绍 redis是一种高级的key-value的存储系统,其中的key是字符串类型,尽可能满足如下几点: 1)key不要太长,最好不要操作1024个字节,这不仅会消耗内存还会降低 ...

  8. java Response 设置中文编码

    response.setHeader("Content-type", "text/html;charset=UTF-8"); response.setChara ...

  9. Patting Heads

    Description It's Bessie's birthday and time for party games! Bessie has instructed the N (1 < N & ...

  10. Ansible自动化运维工具

    ansible软件介绍 python语言是运维人员必会的语言!  ansible是一个基于Python开发的自动化运维工具!(saltstack)  其功能实现基于SSH远程连接服务!  ans ...