Help Center/
Document Database Service/
Developer Guide/
Database Usage Suggestions/
Basic Commands/
Write/Update
Updated on 2022-09-21 GMT+08:00
Write/Update
- Operations such as write, update, delete,and index insert and delete are actually converted to write operations in the background. The underlying storage engines (WiredTiger and RocksDB) use the appendOnly mechanism. Only when the internal data status of the storage engine meets certain conditions, the internal compaction operation is triggered to compress data and release disk space. That is why sometimes the disk usage seems greater than the actual data volume, but your services are not affected.
- The write/update operation involves synchronization to the standby node. You can specify the writeConcern level for the operation. For details, see Write Concern.
Precaution
- update and upsert: If you use upsert, the data you want to insert will be queried first. If the data does not exist, it will be inserted. Otherwise, an update operation is performed. In the preceding scenario, the update or insert command is recommended.
- The update operation also needs to match the index.
- Do not use COLLSCAN to scan the entire table.
- Query conditions and index fields are matched in sequence.
- The size of the document involved in the insert or update command cannot exceed 16 MB.
Parent topic: Basic Commands
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.
The system is busy. Please try again later.