Home > Database > SQL > MongoDB – Polymorphic schema built with schemas

MongoDB – Polymorphic schema built with schemas

步履不停
Release: 2019-07-01 18:02:05
Original
3823 people have browsed it

MongoDB – Polymorphic schema built with schemas

Brief description:

When all documents in a collection have a similar but not identical structure, we call it polymorphic pattern

Example:

In actual business, user posts need to be used. The general structure of the posts is the same, but the specific content needs to be displayed differently according to different post types. Therefore, it is more appropriate to use polymorphic mode at this time. A single query can get all posts and their contents, which improves performance. As shown below:

MongoDB – Polymorphic schema built with schemas

Summary:

Polymorphic mode is used when documents have more similarities than differences. Typical use cases for this pattern design are:

Single view application content management mobile application product catalog

The polymorphic pattern provides an easy-to-implement design that allows queries within a single collection . This is also the schema-less design of mongodb that provides a convenient data construction function.

For more technical articles related to SQL, please visit the SQL Tutorial column to learn!

The above is the detailed content of MongoDB – Polymorphic schema built with schemas. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
mongodb start
From 1970-01-01 08:00:00
0
0
0
linux - ubuntu14 error installing mongodb
From 1970-01-01 08:00:00
0
0
0
Use of symfony2 mongodb
From 1970-01-01 08:00:00
0
0
0
mongodb _id rename
From 1970-01-01 08:00:00
0
0
0
Parameter understanding of mongodb
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template