How To increment field with dot in key?

How do you use the $inc operator with a field with a dot in the key

here’s what i have tried

const filter = { _id :1 }

    const update = {
        $inc: {
          'ratings.1': 1,
          'ratings.2.5':  2
        },
    }

    const options= { upsert:true}
    
    return await db.collection('ratings').update(
      filter,update,options
    )

the result i get in database

   {
        id:1,
        ratings: {
          1: 1,
          2: { 5: 2 }
        }
  }

what i want is

 {
    id:1,
    ratings: {
      1: 1,
      2.5:  2
    }
  }

Welcome to the forum!

I’ve experimented with a few approaches, but couldn’t find a solution.

Do you have the flexibility to change the field name to something like 2_5?

Thanks @Andrew_Morgan

I have the flexibility to change the field name, just wanted to check if there was a way to do it.