Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

50 suggestions for MongoDB developers Tip13

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This series of articles are translated from "50 Tips and Tricks for MongoDB Developers". I can't find the Chinese version for the time being. Anyway, I have been studying mongodb deeply recently, so I just want to translate it. On the one hand, enhance the effect of our own learning, on the other hand, let the big family to experience what we mongodb users need to pay attention to.

First of all, I declare that my English level is not too high, and some English translation into Chinese can not find suitable words to express, so the original English words may appear in the article, or the translation in some places will be a little blunt, that is to say, there will be literal translation. The main purpose of translating this book is for everyone to learn and explore. If there is any inaccuracy in translation, or if there is a more accurate translation, please point out that I will correct it in time. Thank you in advance.

Tip#13.Write code to handle data integrity issue

Solve the problem of data integrity with code

Considering the inherent non-structural nature of mongodb and the advantages of embedded structure, you need to ensure data consistency in your application.

Data inconsistencies can cause problems with the system.

Tip#1.Duplicate data for speed,reference data for integrity (data redundancy is for performance, and referencing data is for integrity.)

Tip10.Design documents to be self-sufficient (designing documents to be self-sufficient)

If you listen to the above two suggestions, there will be data inconsistencies. For these types of inconsistencies, you need to write some scripts to check your data.

If you use some of the previous suggestions, depending on your application, you may need to match some batch jobs. For example:

Consistency check, check calculated values and duplicate data, so that everyone has a consistent value. Pre-populate and create some documents you will need in the future. Aggregator, keep updating your aggregation values.

Some other scripts that may be required.

The structure Checker checks whether your document contains specific fields, or even modifies those fields that are in question, or notifies you that there is an incorrect document. Backup jobs, forced data synchronization, locks, backup databases and other scheduled jobs.

Run these jobs in the background to protect your data.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report