Im using pymongo
version 4.3.3 and motor
version 3.1.2
This is my code:
async def add_reputation_to_db(
self,
guild_id: hikari.Snowflake,
user_recieve_id: hikari.Snowflake,
) -> None:
await self._guild_collection.update_one({'_id': guild_id}, {'$inc': {f'{user_recieve_id}.reputation': 1}})
I have no errors with it, but the problem is that database does not update any data if I use a point to jump to a certain key in the dictionary, in my case it is f'{user_recieve_id}.reputation'
.
The hierarchy of my document looks like this:
{
'_id': guild_id,
'user_id': {
'reputation': 123
}
}
But user_id
must be the user identifier as number.
I looked for solutions on the Internet and ChatGPT, but it did not give me any results.