Assuming you’re on MongoDB 5 or above, to avoid issues with the dots in the IP address being treated as a path expression, you will need to use $getField and $setField.

Put that in an update aggregation pipeline to first get the current value, add 1, then set that as the value. In Python, you could do:

user_ip = "127.0.0.1"
update_pipeline = [
    {
        "$set": {
            "ips": {
                "$setField": {
                    "field": user_ip,
                    "input": "$ips",
                    "value": {
                        "$add": [
                            {
                                "$getField": {
                                    "field": user_ip,
                                    "input": "$ips",
                                }
                            },
                            1
                        ]
                    }
                }
            }
        }
    }
]
collection.update_many({ <user filter here> }, update_pipeline)

Mongo Playground example with more docs. Note that non-matching IP addresses are un-changed.