Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

11.1.6 MongoDB和关系型数据库术语对比图.md #80

Open
lemontree8801 opened this issue May 11, 2020 · 0 comments
Open

11.1.6 MongoDB和关系型数据库术语对比图.md #80

lemontree8801 opened this issue May 11, 2020 · 0 comments

Comments

@lemontree8801
Copy link

lemontree8801 commented May 11, 2020

写了一下MySQL与MongoDB的对比

概念对比

MySQL MongoDB
Database Database
Table Collection
Row JSON or BSON
Column Field
Index Index
table joins(表连接) $lookup或嵌套文档
primary key(主键) _id
统计分析 aggregation
Redo日志 Journal日志
Binlog日志 Oplog日志

模式语句对比

SQL模式语句 MongoDB模式语句
create table db.test.insert({x:1})或db.createCollection("test")
alter table add column db.test.update({},{'$set':{a:2}})
alter table drop column 删除字段$unset
create index db.test.createIndex({x:1,a:-1})
drop table或者truncate table db.test.drop()
drop database db.dropDatabase()
insert into db.test.insertOne()或db.test.insert()
select col1 from test order by a limit 1,2 db.test.find({xxx:10},{x:1,a:1}).sort({a:1}).skip(1).limit(2)
update db.test.update({x:1},{$set:{a:6}})
delete from db.test.deleteMany({x:1})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant