I have the following model schema:
var memberSchema = mongoose.Schema({
\'project\' : {
\'type\' : Schema.Types.ObjectId,
\'ref
To define a field in an embedded object named type, you need to use the object notation to define its type or Mongoose thinks it's defining the type of the parent object.
So change your schema to:
var memberSchema = mongoose.Schema({
'project' : {
'type' : Schema.Types.ObjectId,
'ref' : 'Project'
},
'first' : String,
'last' : String,
'email' : String,
'tracker' : {
'etag' : String,
'id' : String,
'photoLink' : String,
'role' : String,
'type' : {'type': String}, // Here...
},
'survey' : {
'etag' : String,
'id' : String,
'photoLink' : String,
'role' : String,
'type' : {'type': String}, // ...and here
},
});