[Python] Motor returning None

Discussão em 'Python' iniciado por Stack, Julho 2, 2025.

  1. Stack

    Stack Membro Participativo

    I am using Motor driver to connect to Mongo DB. Below is the code to insert data to the collection

    client = motor.MotorClient('mongodb://localhost:27017').open_sync()
    conn = client['database']['collection']
    result = conn.insert({'foo': 'bar'})
    print 'result:', result


    The insert statement always returns None. This is not a Tornado application. Can motor be only used with Tornado? If not why is the insert returning none?

    Continue reading...

Compartilhe esta Página