SQL - MongoDB 매핑 차트
In addition to the charts that follow, you might want to consider the 자주 묻는 질문 section for a selection of common questions about MongoDB.
Terminology and Concepts
The following table presents the various SQL terminology and concepts and the corresponding MongoDB terminology and concepts.
SQL Terms/Concepts | MongoDB Terms/Concepts |
---|---|
database | |
table | |
row | |
column | |
index | |
table joins |
|
기본 키 Specify any unique column or column combination as primary key. | |
aggregation (e.g. group by) | 집계 파이프라인 See the SQL-집계 매핑 차트. |
NEW_TABLE로 선택 | See the SQL-집계 매핑 차트. |
테이블로 병합 | See the SQL-집계 매핑 차트. |
모두 통합 | |
트랜잭션 | For many scenarios, the denormalized data model (embedded documents and arrays) will continue to be optimal for your data and use cases instead of multi-document transactions. That is, for many scenarios, modeling your data appropriately will minimize the need for multi-document transactions. |
Executables
The following table presents some database executables and the corresponding MongoDB executables. This table is not meant to be exhaustive.
예시
The following table presents the various SQL statements and the corresponding MongoDB statements. The examples in the table assume the following conditions:
The SQL examples assume a table named
people
.The MongoDB examples assume a collection named
people
that contain documents of the following prototype:{ _id: ObjectId("509a8fb2f3f4948bd2f983a0"), user_id: "abc123", age: 55, status: 'A' }
Create and Alter
The following table presents the various SQL statements related to table-level actions and the corresponding MongoDB statements.
SQL Schema Statements | MongoDB Schema Statements | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Implicitly created on first
However, you can also explicitly create a collection:
| ||||||||||||||
| Collections do not describe or enforce the structure of its documents; i.e. there is no structural alteration at the collection level. However, at the document level,
| ||||||||||||||
| Collections do not describe or enforce the structure of its documents; i.e. there is no structural alteration at the collection level. However, at the document level,
| ||||||||||||||
|
| ||||||||||||||
|
| ||||||||||||||
|
|
For more information on the methods and operators used, see:
다음도 참조하세요.
Insert
The following table presents the various SQL statements related to inserting records into tables and the corresponding MongoDB statements.
SQL INSERT Statements | MongoDB insertOne() Statements | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
자세한 내용은 db.collection.insertOne()
를 참조하세요.
다음도 참조하세요.
Select
The following table presents the various SQL statements related to reading records from tables and the corresponding MongoDB statements.
참고
SQL SELECT Statements | MongoDB find() Statements | ||||||||
---|---|---|---|---|---|---|---|---|---|
|
| ||||||||
|
| ||||||||
|
| ||||||||
|
| ||||||||
|
| ||||||||
|
| ||||||||
|
| ||||||||
|
| ||||||||
|
| ||||||||
|
| ||||||||
|
| ||||||||
|
-또는-
| ||||||||
|
-또는-
| ||||||||
|
| ||||||||
|
| ||||||||
|
or
| ||||||||
|
or
| ||||||||
|
or
| ||||||||
|
or, for distinct value sets that do not exceed the BSON size limit
| ||||||||
|
or
| ||||||||
|
| ||||||||
|
|
For more information on the methods and operators used, see
다음도 참조하세요.
Update Records
The following table presents the various SQL statements related to updating existing records in tables and the corresponding MongoDB statements.
SQL Update Statements | MongoDB updateMany() Statements | |||||||
---|---|---|---|---|---|---|---|---|
|
| |||||||
|
|
For more information on the method and operators used in the examples, see:
다음도 참조하세요.
Delete Records
The following table presents the various SQL statements related to deleting records from tables and the corresponding MongoDB statements.
SQL Delete Statements | MongoDB deleteMany() Statements | |||
---|---|---|---|---|
|
| |||
|
|
자세한 내용은 db.collection.deleteMany()
를 참조하세요.
다음도 참조하세요.
추가 읽기
If you are considering migrating your SQL application to MongoDB, download the MongoDB Application Modernization Guide.
다음과 같은 리소스가 다운로드에 포함됩니다.
MongoDB를 사용한 데이터 모델링 방법론에 대한 프레젠테이션
RDBMS 데이터 모델에서 MongoDB로 마이그레이션하기 위한 모범 사례와 고려 사항을 다룬 백서
RDBMS에 해당하는 MongoDB 스키마 참조
애플리케이션 현대화 스코어카드