If you just use Mongoose to read from a collection, you can leave the schema definition empty.
So, if you have a read-only collection called test , something like this will work:
var Test = mongoose.model('Test', new Schema(), 'test'); Test.findOne({name: 'John'}, function(err, doc) { ... });
Or, to improve performance, include lean() in the query chain if you don't need any model instance functionality:
Test.findOne({name: 'John'}).lean().exec(function(err, doc) { ... });
If you are not using lean() , you need to access the properties of the document using the get method; eg:
doc.get('name')
source share