Skip to content

Commit

Permalink
chore: fix hit counter
Browse files Browse the repository at this point in the history
  • Loading branch information
muety committed Feb 14, 2022
1 parent b650559 commit 8b8b124
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/controllers/shortlink.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ module.exports = function (app, passport) {
const regex = new RegExp(`.*${req.params.id}$`, 'i')
Collection.findOneAndUpdate(
{ name: config.shortlinkCollectionName, 'links.url': regex },
{ $inc: { 'links.$.hits': 1 } }
{ $inc: { 'links.$.hits': 1 } },
{},
err => !!err && logger.error(err)
)

return res.redirect(obj.url)
Expand Down

0 comments on commit 8b8b124

Please sign in to comment.