Developer data platform
Enterprise software and support
Free software used by millions
Build faster
By Industry
By Use Case
Developer Data Platform
Innovate fast at scale with a unified developer experience
White Papers & Presentations
Webinars, white papers, datasheets and more
Community
Education
About
Services
Partnerships
mongosh
mongo
Docs Home → MongoDB Manual
db.collection.ensureIndex(keys, options)
db.collection.ensureIndex() has been replaced by db.collection.createIndex().
db.collection.ensureIndex()
db.collection.createIndex()