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 ...
随机推荐
- Windows7 安装TensorFlow(本人试了好多方法后的成果)
本人机器为64位win7 首先安装python,版本一定要注意,TennsorFlow要使用 Python3.0 系列版本不能使用2.0系列版本,但是TensorFlow 的安装包目前windows版 ...
- 动态合并GridView数据行DataRow的列
前段时间,Insus.NET一直在演示GridView控件Header头行或列:<动态变更GridView控件列名>和<动态合并或定制GridView控件Header头某些列> ...
- spring aop实现权限管理
问题源于项目开发 最近项目中需要做一个权限管理模块,按照之前同事的做法是在controller层的每个接口调用之前上做逻辑判断,这样做也没有不妥,但是代码重复率太高,而且是体力劳动,so,便有了如题所 ...
- Cannot find module 'webpack/bin/config-yargs'
1.版本不兼容 npm install webpack-dev-server@1.15.0 -g
- DB2安装步骤
##################################DB2的安装########################### ## 安装前准备 ## 关闭内存地址随机化机制 vi /etc/ ...
- Generic detail view PostDetailView must be called with either an object pk or a slug.解决
Django 使用DetailView有这个问题,url,和模板统一调用模型时,用pk,而不是id 如果不是用DetailView,只是简单的视图,则用pk 或者id都可以. urls.py: url ...
- ul li做横向导航栏例子
/* ul li以横排显示 */ /* 所有class为menu的div中的ul样式 */ div.menu ul { list-style:none; /* 去掉ul前面的符号 */ margin: ...
- tfs强行签入和删除工作区
作者:为爱痴狂 原文:http://www.cnblogs.com/splyn/archive/2011/10/31/2230213.html 域用户被网络管理员重建,或者其他用户牵出文档,导致的TF ...
- java读取配置到Hash表里
import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; im ...
- hdu-2036求任意多边形面积
改革春风吹满地 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Sub ...