In the view html page there is a form with a table and when i submit the form two objects are created cvm and schedules for form and table. i somehow want schedules(which is an array) to be related to cvm form. so i tried this way...

**Here is the defined model**

```
    $scope.addSchedule=function(schedule)
      {
      console.log(schedule.startDate);
      console.log(schedule.location);
      $scope.schedules.push({
        startDate: schedule.startDate,
        location: schedule.location
        });
      schedule.startDate='';
      schedule.location='';
      };
    var inData={'cvm': $scope.cvm,'schedules': $scope.schedules};
    $scope.addCvm=function()
      {
      console.log($scope.cvm);
      console.log($scope.schedules);
      $http.post('/cvmApi',inData).success(function(response) {
      console.log(response);
      refresh();
      });
      };

```

**sever side Connection**

 *i guess somthing i missed in this part*

```
/* POST */
router.post('/', function(req, res, next) 
  {
    console.log("Cvm api post '/'");
    console.log("retrieving:: " + req.body);
    cvmModel.create(req.body, function (err, post) {
    console.log("saving:: " + post);
    if (err) return next(err);
    res.json(post);
      });
  });

```

**Here is my schema for mongodb**

```
               'use strict';

                var mongoose = require('mongoose');

                var cvmSchema = new mongoose.Schema({
                visitOrganization:  { type: String },
                visitAgenda:    { type: String },
                accountManager:     { type: String },
                visitCoordinator:   { type: String },
                schedules:[{
                    startDate: String,
                    location: String
                }]
                });

                module.exports = mongoose.model('visit', cvmSchema);

```

*plz help !! thanks in advance*