MongoError: Cannot increment with non-numeric argument

async run(client, message, args, profileData) {

try {

await profileModel.findOneAndUpdate(

  {

    userID: message.author.id,

  },

  {

    $inc: {

      rank: args[0],

    },

  }

)

} catch (err) {

  console.log(err);

};

}

Got this code, getting an error that it cant increment with non-number argument. my schema is a string:
rank: { type: String, default: “ManaPlayer” },

The error said that it cannot increment with a non-number argument. You also confirmed that rank is a string. A string is not a number so you cannot use $inc.

1 Like

How do i change strings in mongoose?