I have two mongo database residing on different host/mongo instances i.e., DB1 in host1 and DB2 in host2. Aggregate query with $merge on DB1 to output the results to DB2 failed with the following error.
java.lang.Exception: com.mongodb.MongoCommandException: Command failed with error 13 (Unauthorized):
'not authorized on DB2 to execute command.
Is there anyway out to make $merge to work across different mongo instances?