Følgende er den brugbare kode testet på pymongo version 3.6.1 og 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