check two object id is equal mongoose code example
Example 1: compare mongoose id
user._id.toString() === request.params.id
Example 2: comparing mongoose ids and strings
// use .equals()
first._id.equals(another._id)
user._id.toString() === request.params.id
// use .equals()
first._id.equals(another._id)