A
A
Arem Developer2020-10-21 16:30:31
Python
Arem Developer, 2020-10-21 16:30:31

How do I compare two values ​​from pymongo?

Here is a piece of code:

elif rolecoll.find_one({"_idRole": role.id})["cost"] > collection.find_one({"_id": member.id})["cash"]:

This method of comparison does not work for me, help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
PavelMos, 2020-10-22
@PavelMos

Check if there is something at all, otherwise None will not have cost and cash elements
Check if there are cost and cash elements in the found
Check what type of data they contain

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question