本文整理汇总了C++中NamespaceString::isSpecial方法的典型用法代码示例。如果您正苦于以下问题:C++ NamespaceString::isSpecial方法的具体用法?C++ NamespaceString::isSpecial怎么用?C++ NamespaceString::isSpecial使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NamespaceString
的用法示例。
在下文中一共展示了NamespaceString::isSpecial方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readLocal
intrusive_ptr<DocumentSourceOut> DocumentSourceOut::create(
NamespaceString outputNs,
const intrusive_ptr<ExpressionContext>& expCtx,
WriteModeEnum mode,
std::set<FieldPath> uniqueKey,
boost::optional<ChunkVersion> targetCollectionVersion) {
// TODO (SERVER-36832): Allow this combination.
uassert(
50939,
str::stream() << "$out with mode " << WriteMode_serializer(mode)
<< " is not supported when the output collection is in a different database",
!(mode == WriteModeEnum::kModeReplaceCollection && outputNs.db() != expCtx->ns.db()));
uassert(50992,
str::stream() << "$out with mode " << WriteMode_serializer(mode)
<< " is not supported when the output collection is the same as the"
<< " aggregation collection",
mode == WriteModeEnum::kModeReplaceCollection || expCtx->ns != outputNs);
uassert(ErrorCodes::OperationNotSupportedInTransaction,
"$out cannot be used in a transaction",
!expCtx->inMultiDocumentTransaction);
auto readConcernLevel = repl::ReadConcernArgs::get(expCtx->opCtx).getLevel();
uassert(ErrorCodes::InvalidOptions,
"$out cannot be used with a 'linearizable' read concern level",
readConcernLevel != repl::ReadConcernLevel::kLinearizableReadConcern);
// Although we perform a check for "replaceCollection" mode with a sharded output collection
// during lite parsing, we need to do it here as well in case mongos is stale or the command is
// sent directly to the shard.
if (mode == WriteModeEnum::kModeReplaceCollection) {
LocalReadConcernBlock readLocal(expCtx->opCtx);
uassert(17017,
str::stream() << "$out with mode " << WriteMode_serializer(mode)
<< " is not supported to an existing *sharded* output collection.",
!expCtx->mongoProcessInterface->isSharded(expCtx->opCtx, outputNs));
}
uassert(17385, "Can't $out to special collection: " + outputNs.coll(), !outputNs.isSpecial());
switch (mode) {
case WriteModeEnum::kModeReplaceCollection:
return new DocumentSourceOutReplaceColl(
std::move(outputNs), expCtx, mode, std::move(uniqueKey), targetCollectionVersion);
case WriteModeEnum::kModeInsertDocuments:
return new DocumentSourceOutInPlace(
std::move(outputNs), expCtx, mode, std::move(uniqueKey), targetCollectionVersion);
case WriteModeEnum::kModeReplaceDocuments:
return new DocumentSourceOutInPlaceReplace(
std::move(outputNs), expCtx, mode, std::move(uniqueKey), targetCollectionVersion);
default:
MONGO_UNREACHABLE;
}
}