官术网_书友最值得收藏!

Embedded documents

A better data-modeling solution would be simply to collapse the normalized relationships and fold the related information into embedded (https://docs.mongodb.com/manual/core/data-model-design/#data-modeling-embedding) documents. Using the preceding example, the better solution would appear as follows:

Using embedded documents, with a single query, you can easily obtain a consolidated block of information, which includes the customer name, purchase date, and specifics on the item.

MongoDB also supports creating indexes ( https://docs.mongodb.com/manual/indexes/) on any given field, which boosts query performance. The auto-generated _id field is automatically indexed. It should be noted, however, that creating too many indexes will have a negative impact on performance when writing data.

主站蜘蛛池模板: 壶关县| 双辽市| 隆尧县| 江阴市| 商水县| 三亚市| 通海县| 改则县| 南宁市| 朝阳县| 衡山县| 静乐县| 清远市| 宁都县| 正镶白旗| 杭锦后旗| 民丰县| 临安市| 宿迁市| 白城市| 银川市| 景洪市| 菏泽市| 香港 | 格尔木市| 葫芦岛市| 石屏县| 德惠市| 盐津县| 灌南县| 禄丰县| 视频| 余干县| 武胜县| 顺昌县| 天镇县| 渭源县| 万全县| 武隆县| 邯郸市| 安陆市|