Open Billydubb opened 6 years ago
Your Employee class shoul extend the EmbeddedDocument class which needs to be pulled in.
//add this to top var EmbeddedDocument = require('camo').EmbeddedDocument;
//change this class Employee extends Document {
//to this class Employee extends EmbeddedDocument {
//change this var uri = 'nedb://companies';
//to this var uri ='nedb:///companies';
Im also not sure you can have circular references like the employee.company tryin to save an employee object inside a company object that has an array of an employee object is probably not going to work. Other than that your code looks good to me.
Below is the full working example that leads to the following error. The problem is that company defines a field named
employees
but in the example I am trying to assign a value toemployee
. I was hoping that programmer errors like these would be part of the errors that the ORM/ODM would catch.