Docs Home → Develop Applications → MongoDB Manual
db.collection.ensureIndex()![](/zh-cn/docs/v5.3/assets/link.svg)
This version of the documentation is archived and no longer supported. View the current documentation to learn how to upgrade your version of MongoDB server.
Note
Removed in 5.0
db.collection.ensureIndex()
has been replaced by
db.collection.createIndex()
.