-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: CLI Module
-
None
-
3
-
Iteration Grouper, Iteration Herring, Iteration Isopod, Iteration Jellyfish, Iteration Lobster, Iteration Porpoise
-
Not Needed
(From edited Slack discussion)
There's a difference between the old and new shells.
collMod should return a CannotConvertIndexToUnique error with a list of conflicting documents.
Test collection:
db.apples.insertMany( [
,
,
,
,
,
] )
test> db.runCommand( {
collMod: "apples",
index: {
keyPattern:
,
unique: true
}
} )
mongosh response:
MongoServerError: Cannot convert the index to unique. Please resolve conflicting documents before running collMod again.
mongo shell response
{
"ok" : 0,
"errmsg" : "Cannot convert the index to unique. Please resolve conflicting documents before running collMod again.",
"code" : 359,
"codeName" : "CannotConvertIndexToUnique",
"violations" : [
]
}
- is related to
-
DRIVERS-2385 Provide access to raw result document when the server returns an error for a command
- Implementing
- related to
-
SERVER-61158 Convert a non-unique index to a unique index via the collMod command
- Closed