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

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.

主站蜘蛛池模板: 阳朔县| 泉州市| 常熟市| 盈江县| 上思县| 福贡县| 商河县| 永嘉县| 永德县| 舟山市| 灵丘县| 大余县| 昭苏县| 福鼎市| 葵青区| 莒南县| 宕昌县| 广德县| 行唐县| 泗洪县| 合川市| 宝坻区| 慈溪市| 临安市| 永康市| 定结县| 天津市| 上犹县| 郁南县| 固原市| 黄骅市| 黄冈市| 夏津县| 上饶县| 泌阳县| 横峰县| 太康县| 永胜县| 赤城县| 横山县| 墨江|