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. Visual Studio 代码格式化插件(等号自动对齐、注释自动对齐等)

    1.下载地址 插件:Code alignment  下载地址 2.介绍 Based on principles borrowed from mathematics and other discipli ...

  2. 2015年第六届蓝桥杯省赛试题(JavaA组)

    1.结果填空 (满分3分)2.结果填空 (满分5分)3.结果填空 (满分9分)4.代码填空 (满分11分)5.代码填空 (满分13分)6.结果填空 (满分17分)7.结果填空 (满分21分)8.程序设 ...

  3. java读取classpath下properties文件注意事项

    1.properties文件在classpath根路径下读取方式 Properties properties = new Properties(); properties.load(BlogIndex ...

  4. 21天网站建设实录 (雨辰资讯) 高清pdf扫描版​

    <21天网站建设实录>以网页设计师的项目开发为背景,以“阿里里在线购物”商业网站的开发过程为流程,通过21天的任务期限,以一天一项任务.一天掌握一项技能项目实战的学习模式,全面讲解了一个网 ...

  5. 海量推荐系统:mapreduce的方法

    1. Motivation 2. MapReduce MapReduce是一种数据密集型并行计算框架. 待处理数据以"块"为单位存储在集群机器文件系统中(HDFS),并以(key, ...

  6. EXCEL跨表比较两列,并填充新值背景

    Sub FillNewToYellow() Dim dic Dim oldArr(), updatedArr() On Error Resume Next If Worksheets("ol ...

  7. Binder学习笔记(三)—— binder客户端是如何组织checkService数据的

    起点从TestClient.cpp的main函数发起: int main() { sp < IServiceManager > sm = defaultServiceManager(); ...

  8. 关于Logger

    Logger是我在各类编程语言中使用最多,同时也是改进最多的一个函数,今天在iOS下又折腾了一番,终于找到我想要的一个版本,这里做一个总结. python版 python对logger有专门的支持,只 ...

  9. QQ空间爬虫--获取好友信息

    QQ空间网页版:https://user.qzone.qq.com/ 登陆后,进入设置,有一个权限设置,设置“谁能看我的空间”为好友可见,然后构造爬虫. (1)获取Cookie 两种方式: 第一种:通 ...

  10. CoreAnimation 核心动画 / CABasicAnimation/ CAKeyframeAnimation

    - (void)createBaseAnimation{ //基础动画 CABasicAnimation *animation = [CABasicAnimation animation]; anim ...