Details
-
Question
-
Resolution: Works as Designed
-
Trivial - P5
-
None
-
None
-
None
Description
Hi there,
I am a little confused with the pipeline stages of ADD_ALT_NAMESPACE_STAGE and UNSET_ORIGINAL_NAMESPACE_STAGE in MongoCopyDataManager.
May I ask the reason we need these two stages?
private static final String PIPELINE_TEMPLATE = |
format(
|
"{$replaceRoot: " |
+ "{newRoot: {" |
+ "_id: {_id: '$_id', copyingData: true}, " |
+ "operationType: 'insert', " |
+ "%s: {db: '%%s', coll: '%%s'}" |
+ "documentKey: {_id: '$_id'}, " |
+ "fullDocument: '$$ROOT'}}" |
+ "}", |
NAMESPACE_FIELD);
|
|
|
private static final BsonDocument ADD_ALT_NAMESPACE_STAGE = |
BsonDocument.parse(
|
format("{'$addFields': {'%s': '$%s'}}", ALT_NAMESPACE_FIELD, NAMESPACE_FIELD)); |
private static final BsonDocument UNSET_ORIGINAL_NAMESPACE_STAGE = |
BsonDocument.parse(format("{'$project': {'%s': 0}}", NAMESPACE_FIELD)); |