|
Some weirdness has arisen as a result of my SERVER-52538 changes.
When you execute a command like "create", it parses the BSON input and creates a Collation object with all fields initialized (except "backwards" if the user didn't provide it). The Collation is turned into BSON, then parsed again, see CmdCreate in dbcommands.cpp:
if (cmd.getCollation()) {
|
auto collatorStatus =
|
CollatorFactoryInterface::get(opCtx->getServiceContext())
|
|
->makeFromBSON(cmd.getCollation()->toBSON());
|
uassertStatusOK(collatorStatus.getStatus());
|
defaultCollator = std::move(collatorStatus.getValue());
|
}
|
The call to CollatorFactoryICU::makeFromBSON(), above, parses the BSON back into
a Collation. Then makeFromBSON() calls updateCollationSpecFromICUCollator with
BSONObj spec, Collation* collation.
This isn't perfect, but fixing it is a larger refactor than I'm willing to do
right now. I think the ideal code would represent collation options using Collation structs exclusively, rather than BSON objects, except when parsing the client request and serializing the reply.
|