You need to drop the old, non-sparse index in the shell so that Mongoose can recreate it with sparse: true the next time your app runs.> db.contacts.dropIndex('name_1') 这篇关于使用稀疏:true仍在获取MongoError:E11000重复键错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-10 22:53