`
sillycat
  • 浏览: 2552001 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

mongodb(1)Some mongodb concept and installation on my servser

 
阅读更多
mongodb(1)Some mongodb concept and installation on my servser

1. Comparison between SQL and MongoDB
I am a new guy for mongoDB, coming from a SQL-background.
MySQL term             Mongo term/Concept
database                 database
table                      collection
index                      index
row                        BSON document
column                   BSON field
join                         embedding and linking
primary key              _id field
group by                 aggregation

BSON is a binary-encoded serialization of JSON-like documents. http://bsonspec.org/

SQL Statement                               Mongo Statement
create table users                            db.createCollection("users");
alter table users add ...

insert into users values ...                 db.users.insert({a:3,b:5})
select a,b from users                        db.users.find({},{a:1,b:1})

select * from users                          db.users.find()
select a,b from users where age =33    db.users.find({age:33},{a:1,b:1})
select * from users where age=33 order by name  db.users.find({age:33}).sort({name:1})
select * from users where name like "%sillycat%"    db.users.find({name:/sillycat/})

select * from users where name like "sillycat%"   db.users.find({name:/^sillycat/})

select * from users where age>33 and age <=40      db.users.find({'age':{&gt:33,$lte:40}})

select * from users order by name desc     db.users.find().sort({name:-1})

select * from users where a=1 and b='q'    db.users.find({a:1,b:'q'})

select * from users limit 10 skip 20     db.users.find().limit(10).skip(20)
select * from users where a=1 or b=2     db.users.find({$or : [ {a:1},{b:2} ] } )
select * from users limit 1          db.users.findOne()

select count() from users             db.users.count()
select count() from users where age > 30    db.users.find({age:{'$gt':30}}).count()

update users set a=1 where b='q'    db.users.update({b:'q'},{$set:{a:1}},false,true)

delete from users where z = 'abc'      db.users.remove({z:'abc'})

2. Example database Information
{
   "_id" : "" ,
   "firstName" : ""
   "lastName" : ""
   "username" : ""
   "password" : "" ,
   "role" : { "$ref" : "role" , "$id" : "" }
}

{
   "_id" : ""
   "role" : ""
}

3. MogonDB Setup
windows7-64 bit
http://downloads.mongodb.org/win32/mongodb-win32-x86_64-2.0.5.zip, I got the latest windows files
Unzip the file to D:\tool\mongodb_2.0.5\bin
create a folder here C:\data\db
Add the bin to my path.
Then I can type the command as follow:
>mongod.exe
or
>mongod.exe -dbpath c:\data\db

ubuntu12.04
>sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
add this line to source.list
>sudo vi /etc/apt/sources.list
add this line
deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
>sudo apt-get update
>sudo apt-get install mongodb-10gen

The configuration file is here /etc/mongodb.conf


references:
http://hi.baidu.com/luohuazju/blog/item/f256abf3f94a265b342acc54.html
http://krams915.blogspot.com/2012/01/spring-mvc-31-implement-crud-with_4739.html
https://github.com/krams915/spring-mongodb-tutorial.git
http://www.mongodb.org/display/DOCS/SQL+to+Mongo+Mapping+Chart
http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages
http://static.springsource.org/spring-data/data-document/docs/current/reference/html/

分享到:
评论

相关推荐

    MongoDB and Python

    Python MongoDB 应用开发,构建高效稳定数据库应用系统

    Big.Data.NoSQL.Architecting.MongoDB.epub

    The book covers details on Architecting, Developing and Administering MongoDB. Big Data, MongoDB will not only help you get started in the traditional “How-To” sense, but also provide meaningful ...

    深入学习MongoDB:Scaling MongoDB && 50 Tips and Tricks for MongoDB Developers

    深入学习MongoDB:Scaling MongoDB && 50 Tips and Tricks for MongoDB Developers深入学习MongoDB中文版Scaling MongoDB英文版50 Tips and Tricks for MongoDB Developers英文版高清完整目录3本打包合集

    MongoDB.Data.Modeling.1782175342

    This book is intended for database professionals, software developers, and architects who have some previous experience with MongoDB and now want to shift their focus to the concepts of data modeling....

    Practical MongoDB - Architecting, Developing, and Administering

    根据提供的文件信息,本书《Practical MongoDB - Architecting, Developing, and Administering》由Shakuntala Gupta Edward和Navin Sabharwal合著,旨在为读者提供MongoDB的全面指南,涵盖架构、开发和管理等方面。...

    mongodb c#驱动最新驱动mongodb.driver.dll 版本2.12.0-beta1

    标题提到的是 MongoDB 的 C# 驱动的最新版本——mongodb.driver.dll,具体为 2.12.0-beta1 版本。 MongoDB.Driver.dll 是 C# 驱动的核心组件,它包含了连接、查询、更新和操作 MongoDB 数据库所需的所有功能。这个...

    mongodb 4.4.19

    mongodb-org-4.4.19-1.el7.x86_64.rpm mongodb-org-mongos-4.4.19-1.el7.x86_64.rpm mongodb-org-server-4.4.19-1.el7.x86_64.rpm mongodb-org-shell-4.4.19-1.el7.x86_64.rpm mongodb-org-tools-4.4.19-1.el7.x86_...

    linux安装mongodb教程

    /usr/local/mongodb/mongodb-linux-2.0.7/bin/mongod --dbpath=/usr/local/mongodb/data/db --logpath=/usr/local/mongodb/mongodb-linux-2.0.7/logs/mongodb.log --logappend --port=27017 --fork 知识点 6:配置...

    MongoDB on Kubernetes技术解决方案.pptx

    MongoDB on Kubernetes技术解决方案 MongoDB on Kubernetes技术解决方案旨在提供一种快速、灵活和高效的方式来部署和管理MongoDB数据库在Kubernetes集群中。该解决方案利用Kubernetes的强大API和Operator来实现...

    mongodb安装包和compass

    MongoDB是一款开源、分布式、高性能的NoSQL数据库,它不使用传统的表格和列式结构来存储数据,而是采用键值对、文档、集合和图形数据模型。这种设计使得MongoDB在处理非结构化和半结构化数据时表现出色,特别适合大...

    7_webstorm配置mongodb1

    1. 安装MongoDB插件:在WebStorm中,需要安装MongoDB插件,以便支持MongoDB数据库。可以在Settings中搜索“MongoDB”找到插件,然后点击安装。 2. 创建MongoDB连接:在WebStorm中,点击“Database”工具栏,然后点击...

    Mastering MongoDB 3.x

    The book is based on MongoDB 3.x and covers topics ranging from database querying using the shell, built in drivers, and popular ODM mappers to more advanced topics such as sharding, high ...

    mongodb1067错误解决1

    1. **定位配置文件**:根据提供的示例,MongoDB的配置文件位于`E:\ruanjian\MongoDB\mongod.cfg`。您可以根据自己的实际情况找到相应的配置文件。 2. **查看配置内容**: - `dbpath`: 指定MongoDB的数据文件存放...

    Linux安装mongodb客户端

    1.创建源 sudo vim /etc/yum.repos.d/mongodb-org-4.2.repo 写入: [mongodb-org-4.2] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.2/x86_64/ gpgcheck=1 ...

    MongoDB实验 - .docx

    MongoDB 实验报告 本实验报告旨在详细介绍 MongoDB 的安装、配置和基本操作步骤,本报告基于 CentOS 7 系统,通过一步一步的截图和文字说明,帮助读者快速掌握 MongoDB 的使用。 一、安装 MongoDB 首先,我们需要...

    MongoDB Community(mongodb-org-server-5.0.8-1.el7.x86_64.rpm)

    MongoDB Community Server(mongodb-org-server-5.0.8-1.el7.x86_64.rpm)适用于RedHat / CentOS 7.0 MongoDB是一个基于分布式文件存储的数据库。由C++语言编写。旨在为WEB应用提供可扩展的高性能数据存储解决方案。...

Global site tag (gtag.js) - Google Analytics