I faced this while writing some tests to a new class method.
>>> doc = {'test': True}
>>> collection.insert_one(doc)
<pymongo.results.InsertOneResult object at 0x031C2D00>
>>> doc
{'test': True, '_id': ObjectId('5e7103a1b650bd01fac6c6ff')}
Why the key _id was added to the variable doc? There's a way to avoid this behaviour from pymongo?