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

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.

主站蜘蛛池模板: 西昌市| 汤阴县| 高雄市| 湘乡市| 曲沃县| 荆门市| 丹寨县| 鹿邑县| 读书| 杭锦后旗| 桑植县| 高要市| 洪雅县| 湄潭县| 三河市| 交口县| 龙井市| 兴山县| 高青县| 灵武市| 九龙城区| 当涂县| 锡林浩特市| 本溪市| 金塔县| 鄂伦春自治旗| 连江县| 洛浦县| 仁怀市| 石河子市| 广平县| 秭归县| 龙岩市| 陈巴尔虎旗| 舞钢市| 观塘区| 扶风县| 修文县| 京山县| 永胜县| 晋州市|