MongoEngine is good for defining a document for data validation. Raw pymongo is lacking in this area. Can I use MongoEngine to define a document first, then use pymongo to insertMany documents into an empty collection? If yes, will pymongo's insertMany() do data validation based on the document definition set by mongoengine?
Can pymongo and mongoengine code be mixed together in the same python script?
I am using python 3.7, mongodb v4.2.7.
Your three questions:
'Can I use MongoEngine to define a document first, then use pymongo to insertMany documents into an empty collection? '
Yes.
'If yes, will pymongo's insertMany() do data validation based on the document definition set by mongoengine?'
No.
'Can pymongo and mongoengine code be mixed together in the same python script?'
Yes.
Mongoengine based on pymongo. If you do not need very complex function that mongoengine not had. I suggest you just use mongoengine to complete your work. This will save your time most of the time.
Can one use mongoengine to define a document first, then use pymongo to insert many documents?