SQL到MongoDB映射表

In addition to the charts that follow, you might want to consider the 常问问题 section for a selection of common questions about MongoDB.

可执行文件

The following table presents the MySQL/Oracle executables and the corresponding MongoDB executables.

术语和概念

The following table presents the various SQL terminology and concepts and the corresponding MongoDB terminology and concepts.

例子

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 users.

  • The MongoDB examples assume a collection named users that contain documents of the following prototype:

    {
      _id: ObjectID("509a8fb2f3f4948bd2f983a0"),
      user_id: "abc123",
      age: 55,
      status: 'A'
    }
    

创建和修改

The following table presents the various SQL statements related to table-level actions and the corresponding MongoDB statements.

插入

The following table presents the various SQL statements related to inserting records into tables and the corresponding MongoDB statements.

选择

The following table presents the various SQL statements related to reading records from tables and the corresponding MongoDB statements.

更新记录

The following table presents the various SQL statements related to updating existing records in tables and the corresponding MongoDB statements.

删除记录

The following table presents the various SQL statements related to deleting records from tables and the corresponding MongoDB statements.