forest-express-mongoose icon indicating copy to clipboard operation
forest-express-mongoose copied to clipboard

Collection not found after error message is returned via extended Admin API

Open kevinNgws opened this issue 7 years ago • 0 comments

Was trying to do some business logic when deleting a document via the extended Admin API. When I returned an error message to forest, the intended-to-be-deleted document cannot be viewed. It can only be viewed after the page is refreshed. Am I doing it the wrong way?

Expected behavior

Able to click and view the detail of the selected document even after error message is return via the extended Admin API.

forestAdminApiRouter.route('/Group/:id').delete(async (req, res, next) => { try { res.status(400).send('This is the error message'); } catch (err) { res.status(400).send(err.message); }

Actual behavior

Returns 404 collection not found with error message "The collection you are trying to reach no longer exists, it may have been renamed"

Context

  • Package Version: 2.14.1
  • Express Version: latest
  • Mongoose Version: 5.2.8
  • MongoDB Version: latest

kevinNgws avatar Oct 02 '18 00:10 kevinNgws