'Mongoose model.find({}) retrieving documents not in specified schema

So we have this snippet here that forces a collectionID and grab the appropriate model.

const model = mongoose.model('col', Schema, collectionID); 
return model.find();

Our issue right now is that model.find() is not enforcing the Schema we laid out, and is just grabbing every document in the collection. The above snippet is a function itself, and we have a bunch of functions that instantiate or retrieves the model. Could that be an issue why? Reading the documentation I feel like doing it this way should be fine. The Schema itself is an imported variable like this:

const Schema = new Schema()
export default Schema

None of my other functions are enforcing the schema either.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source