0

I want to build kind of control panel for admin usage. I want him to be able to add custom key values into the scheme. I take the keys from the request body and the types of those keys from the request body as well. My logic is to use the forEach method but it doesn't work... I need any alternate way that will implement my concept.

    router.post('/newschema', function (req, res) {
    var keys = req.body.keys;
    var types = req.body.types;
    new Schema({    
    //wont work
    keys[0] : { type: types[0] }
    });
});
Neil Lunn
  • 148,042
  • 36
  • 346
  • 317
user7326641
  • 23
  • 1
  • 6

0 Answers0