def transform_incoming(self, son, collection):
        """Add an _id field if it is missing.
        """
        if not "_id" in son:
            son["_id"] = ObjectId()
        return son
Add an _id field if it is missing.
        
stackoverflow/venv/lib/python3.6/site-packages/pymongo/son_manipulator.py