给定一个 collection,为其添加别名。示例代码如下:
from pymongo import MongoClient
client = MongoClient()
db = client['myDB']
collection = db['myCollection']
alias = 'myAlias'
db.command('create', alias,
viewOn=collection.name,
pipeline=[{'$match': {}},
{'$project': {'_id': False}}])