Mongoose: Recursive embedded-document in Coffeescript Mongoose: Recursive embedded-document in Coffeescript mongoose mongoose

Mongoose: Recursive embedded-document in Coffeescript


Embedded documents can only exist as items in an array. That is by design, you can ask the authors for their reasons :)

You might want to use a DBRef:

Person = new Schema  mother: { type: Schema.ObjectId, ref: 'Person' }  father: { type: Schema.ObjectId, ref: 'Person' }

(notice you don't need the add call)

See the docs for populate/DBRef.