Executing query and insert operations with PyMongo