
我用db.things.ensureIndex({firstname : 1}, {unique : true, dropDups : true})或者db.things.ensureIndex({firstname : 1}, {unique : true})建立的索引使用db.getCollection('table').getIndexes()都查询不到,请问这是为什么?
现在又报E11000错误,但是我建之前已经清空了所有索引。

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
dropDups从MongoDB3.X之后已经不支持了,因为dropDups可能导致一些不可预期的错误。
从你的错误提示看,:Null 和 1995225402出现重复,你可以进到collection检查。