
Build Node.js RESTful APIs in 10 Minutes - mufi
https://www.codementor.io/olatundegaruba/nodejs-restful-apis-in-10-minutes-q0sgsfhbd
======
mufi
'use strict'; var mongoose = require('mongoose'); var Schema =
mongoose.Schema, ObjectId = Schema.ObjectId;

var CompanySchema = new Schema([{ name: {type: String}, displayName:{type:
String}, erpCode: {type: String}, description:{type: String}

}]);

var OrganizationSchema = new Schema([{

    
    
          name: {
            type: String
          },
          displayName: {
            type: String
          },
          erpCode: {
            type: String
          },
          description: {
            type: String
          },
          companies: { type: ObjectId, ref: 'CompanySchema'}
     }]);
     
    
    

module.export = mongoose.model('Organazations',OrganizationSchema);
module.export = mongoose.model('Companies',CompanySchema);

Below is my model file How do I list all the companies by typing
localhost://organizations/id/companies

