P
Prisma3mo ago
la flame

[MongoDB] dup key: { itemId: null }, labels: {}

Error: MongoDB error
Kind: Command failed: Error code 11000 (DuplicateKey): Index build failed: 83c54d6a-ffb6-44a5-8c6e-4ada6aa59ad6: Collection db.Collection ( 3fb85909-5e6c-4151-9a94-d99bdc225628 ) :: caused by :: E11000 duplicate key error collection: db.Collection index: Collection_itemId_key dup key: { itemId: null }, labels: {}
0: schema_core::state::SchemaPush
at schema-engine/core/src/state.rs:433
Error: MongoDB error
Kind: Command failed: Error code 11000 (DuplicateKey): Index build failed: 83c54d6a-ffb6-44a5-8c6e-4ada6aa59ad6: Collection db.Collection ( 3fb85909-5e6c-4151-9a94-d99bdc225628 ) :: caused by :: E11000 duplicate key error collection: db.Collection index: Collection_itemId_key dup key: { itemId: null }, labels: {}
0: schema_core::state::SchemaPush
at schema-engine/core/src/state.rs:433
Started getting this error for no reason, because I made aggregate and found no itemId with count > 1
1 Reply
la flame
la flame3mo ago
db.Collection.aggregate([{$group : { "_id" : '$itemId', count : {$sum : 1}}}, {$sort : { "count" : -1 }}]) returns { _id: null, count: 10 } and other count == 1 so no duplicates