Expected behaviour: When saving a document with id in parentId field that doesn't point to any document in database, document validation should fail with descriptive error message
Current behaviour: When saving a document with id in parentId field that doesn't point to any document in database, the app crashes with a very non-descriptive error
Steps to recreate:
Create a new project with npm init and configure package.json
Install mongoose and mongoose-materialized with npm
➜ test-project npm start
> test-project@1.0.0 start /Users/user/Documents/projects/test-project
> node index
(node:439) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
(node:439) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
events.js:183
throw er; // Unhandled 'error' event
^
TypeError: done is not a function
at /Users/user/Documents/projects/test-project/node_modules/mongoose-materialized/lib/materialized.js:142:28
at /Users/user/Documents/projects/test-project/node_modules/mongoose/lib/model.js:4784:16
at /Users/user/Documents/projects/test-project/node_modules/mongoose/lib/utils.js:276:16
at /Users/user/Documents/projects/test-project/node_modules/mongoose/lib/model.js:4803:21
at _hooks.execPost (/Users/denisb/Documents/projects/test-project/node_modules/mongoose/lib/query.js:4364:11)
at /Users/user/Documents/projects/test-project/node_modules/kareem/index.js:135:16
at _combinedTickCallback (internal/process/next_tick.js:132:7)
at process._tickCallback (internal/process/next_tick.js:181:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test-project@1.0.0 start: `node index`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test-project@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/user/.npm/_logs/2020-01-17T12_16_06_157Z-debug.log
Expected behaviour: When saving a document with id in parentId field that doesn't point to any document in database, document validation should fail with descriptive error message
Current behaviour: When saving a document with id in parentId field that doesn't point to any document in database, the app crashes with a very non-descriptive error
Steps to recreate:
Result:
Node version: 8.16.2