Berikut ini adalah kode yang bisa diterapkan yang diuji pada pymongo versi 3.6.1 dan python 3.6.4
import pymongo
from pymongo import MongoClient
client = MongoClient('127.0.0.1') # mongodb running locally
dbRead = client['test'] # using the test database in mongo
# create the pipeline required
pipeline = [{"$match": {"$text": {"$search":"StackOverflow"}}},{"$out":"C_b"}] # all attribute and operator need to quoted in pymongo
dbRead.C_a.aggregate(pipeline) #execution
print (dbRead.C_b.count()) ## verify count of the new collection