Fix to prevent error when $id is not a MongoId