'Querying views with nestJS/mongoose

As the title suggests, I am a little confused about working with pre-aggregated views on collections trough Mongoose. I'am able to create a view via the this.connection.createCollection() method -after injecting the connection option- but how should I start querying this view? Below option works but doesn't feel right.

const schema = new mongoose.Schema({ },{strict:false});
let NM = this.connection.model('view', schema,'newsOverview' ) ;
return NM.find()

Any help would be greatly appreciated! Nomis



Sources

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

Source: Stack Overflow

Solution Source