How do I explicitly define data types for a MongoDB collection?
Use the mongoDB document validator. It was introduced in version 3.2 and allow you to validate documents during updates and insertions. It need to be defined when the collection is being created. 

You can define the data types for a collection like this: 

db.createCollection( "log",
   { validator: { $and:
      [
         { capped: { $type: "bool" } },
         { size: { $type: "int" } },
         { max: { $type: "int" } }
      ]
   }
} )


Document validator support types: 

https://docs.mongodb.com/manual/reference/operator/query/type/

Official info about document validator:

https://docs.mongodb.com/manual/core/document-validation/