[Python] Search for a document by ObjectId in mongodb with pymongo

Discussão em 'Python' iniciado por Stack, Abril 12, 2025.

  1. Stack

    Stack Membro Participativo

    I need to search an ObjectId with python using pymongo but I always get an error.

    import pymongo
    from pymongo import MongoClient
    from pymongo import ObjectId

    gate = collection.find({'_id': ObjectId(modem["dis_imei"])})


    Any ideas how to search?

    Continue reading...

Compartilhe esta Página