Closed rmanibus closed 3 years ago
This extension is not compatible with the mongodb driver v4.
after create I have the following error:
error: Unhandled Rejection at: Promise {"hook":{"type":"before","method":"create","path":"api/users","params":{},"data":{"visible":true,"name":"ADMIN","password":"$2a$10$97XORKjmdC55IFVbXB1myucvdC8JCa9Wx2udSD.K93s8IZwO9A80S","permissions":["ADMIN"]}}} TypeError: Cannot read property 'length' of undefined at C:\Users\loich\workspace\project\node_modules\feathers-mongodb\lib\index.js:214:46 at processTicksAndRejections (node:internal/process/task_queues:96:5) {
It is failing on:
const promise = Array.isArray(data) ? this.Model.insertMany(data.map(setId), options) : this.Model.insertOne(setId(data), options); return promise.then(result => result.ops.length > 1 ? result.ops : result.ops[0]) .then(select(params, this.id)) .catch(errorHandler);
It seems that the return format for insertOne changed : https://github.com/mongodb/node-mongodb-native/blob/4.1/docs/CHANGES_4.0.0.md
Steps to reproduce
This extension is not compatible with the mongodb driver v4.
after create I have the following error:
It is failing on:
It seems that the return format for insertOne changed : https://github.com/mongodb/node-mongodb-native/blob/4.1/docs/CHANGES_4.0.0.md