0

I am using angularjs and mongodb and I have schema like the object I paste here.
Now I need to store the whole scope value into an array. Help how to do this and I need insert query for that.

schema

var Schema = new Schema({
    UnitId: String,
    UnitName: String ,

   Details:[{

   }],

    {strict: false});

insert Query

Details:[{         
            // here i want store my req.body scope value
       }],
TGrif
  • 5,725
  • 9
  • 31
  • 52
jose
  • 1,044
  • 1
  • 12
  • 35
  • basically you create a model and then you craete a new instance of that model. To save you use save() method. This is documented in detail in here : http://mongoosejs.com/docs/guide.html – Mihir Bhende May 05 '17 at 15:02
  • Save method okay how to save data inside the array – jose May 05 '17 at 15:03
  • If you are inserting, you can directly add it inside the new as a argument an your new doc structure.. if you want to update you can use $set – Mihir Bhende May 05 '17 at 15:04

0 Answers0