The findByIdDeleted method isn't working as described in the docs.
In the docs it says that findByIdDeleted takes a callback that returns a document
Sample.findByIdDeleted(sampleId, function(err, doc) {
//doc.deletedAt will be current timestamp
//doc.deleted will be true
})
But instead findByIdDeleted isn't doing anything with the callback.
const result = UserModel.findByIdDeleted('60b6dbd320329b2952db39e8', function (err, doc) {
console.log(err || doc); // code never gets here
});
result //> returns a query
Also the function returns a model.Query, not a mongoose document:
model.Query {
_collection:NodeCollection {collection: NativeCollection, collectionName: 'users'}
_conditions:{_id: '60b6dbd320329b2952db39e8', deleted: true}
_distinct:undefined
_executionCount:0
_fields:undefined
...
}
The
findByIdDeletedmethod isn't working as described in the docs.In the docs it says that
findByIdDeletedtakes a callback that returns a documentBut instead
findByIdDeletedisn't doing anything with the callback.Also the function returns a
model.Query, not a mongoose document: