On this page本页内容
The following checklist, along with the Operations Checklist, provides recommendations to help you avoid issues in your production MongoDB deployment.
w:majority
write concern. Three data-bearing nodes are required for replica-set wide data durability.Data in MongoDB has a dynamic schema. Collections do not enforce document structure. This facilitates iterative development and polymorphism. Nevertheless, collections often hold documents with highly homogeneous structures. See Data Modeling Concepts for more information.
_id
index, you must create all indexes explicitly: MongoDB does not automatically create any indexes other than _id
.BSON Document Size
limit is 16MB per document. If you require larger documents, use GridFS.Note
For the following MongoDB versions, pv1
increases the likelihood of w:1
rollbacks compared to pv0
(no longer supported in MongoDB 4.0+) for replica sets with arbiters:
"available"
(which is the default read concern for reads against secondaries when not associated with causally consistent sessions)."available"
. As such, non-targeted or broadcast queries that are not using "available"
can be safely run on any member and will not return orphaned data."available"
read concern can return orphaned documents from secondary members since it does not check for updated chunk metadata. However, if the return of orphaned documents is immaterial to an application, the "available"
read concern provides the lowest latency reads possible among the various read concerns.cursor.maxTimeMS()
for reads and wtimeout for writes if you need to cap execution time for database operations.