Home > Mobile >  mongodb find in python
mongodb find in python

Time:03-07

I have the folowing code:

for result in collection.find({}, {"canvas"}):
    print(result)

it returns this:

{'_id': ObjectId('621fd56893a0600016345993'), 'canvas': {'value1': '-326362238', 'value2': '2087090823'}}
{'_id': ObjectId('6220fa61c084480016455f5d'), 'canvas': {'value1': '838487572', 'value2': '1949564751'}}

I need to access the value1 and value2 but I cannot figure out how to reach for it ...

CodePudding user response:

result['canvas']['value1'] fixes my problem

  • Related