Watch keynotes and sessions from MongoDB.live, our virtual developer conference.

[pymongo] Problem while making a license system

Hi, I’m making a license system for discord server, once I run the !authorize command in a server, my bot creates a value in the database:
View Photo
The only problem is that now when I try to authorize another server, it says that the server is already authorized! The same thing happens if I try to run the !license command, which will show me the license, it shows the information of the first server’s license! There are the codes I use for creating a new value into the database: https://hastebin.com/kehijahefe.sql
The problem is the check = mycol.find({},{'ServerID':server_id}).count() Which returns 1 everytime, even if the server ID is different from the one into the database

Hello, @Silvano_Hirtie! Welcome to the community!

Make sure you’re using .find() method correctly and the arguments are passed in the correct order.
Also, keep in mind, that property names are case-sensetive.

I think you can get the desired result if you modify your query a bit:

mycol.find({ 'serverID': server_id }).count();

Thank you very much! having {} before the serverID string helped me in not having an error, but the main Problem was the uppercase S, serverID worked, thank you again!

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.