Skip to content

Deep nesting #64

@spallesen

Description

@spallesen

Hi there,

I desperately need deep nesting to work in a project im baseing to a large part on forms-angular. The issue is the data is not saved on level 3 and deeper. I need at least 3 levels.

To illustrate the scenario, think of your professional resume/CV you have 3 levels:

  1. level: Basic data on your self (name, email, phone etc.)
  2. level: Jobs you have had previosly (for example: worked for IBM from June 2010 to August 2012 as a proejct manager)
  3. level: Projects I was invoved with during me time at IBM (for example: Global Lean Project from June 2010 to January 2011 and SCRUM Train the Trainer from February 2011 to August 2012)

A simple model to illustrate:

'use strict';

var mongoose = require('mongoose');
var Schema = mongoose.Schema;

var projectSchema = new Schema({
  projectName: {type: String},
  dateFrom: {type: Date},
  dateTo: {type: Date},
  projectDescription: {type: String, form: {type: 'textarea', rows: 'auto'}}
});

var jobSchema = new Schema({
  company: {type: String},
  title: {type: String},
  dateFrom: {type: Date},
  dateTo: {type: Date},
  jobDescription: {type: String, form: {type: 'textarea', rows: 'auto'}},
  projects: {type: [projectSchema]}  
});

var resumeSchema = new Schema({
  surname: {type:String},
  forename: {type:String},
  workHistory: {type: [jobSchema]},

});


var Nesting;
var modelName = 'Nesting';

try {
  Nesting = mongoose.model(modelName);
} catch(e) {
  Nesting = mongoose.model(modelName, resumeSchema);
}

module.exports = Nesting;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions