I need to find the results of a query with mongoose find({}) method in Node.js with a variable containing model name.
find({})
var adSchema = new Sc
Try this:
var mongoose = require('mongoose'); var Schema = mongoose.Schema; var anySchema = new Schema({ fieldname: String }); var Test = mongoose.model('Test', anySchema); Test.find({}).exec(function(err,result){});