Unable to insert data into MongoDB.

Peter Otten __peter__ at web.de
Mon Feb 15 06:36:17 EST 2016

Arjun Srivatsa wrote:

> I changed the port number from 27017 to 55555 in the code segment:

Instead of throwing arbitrary changes at your script in the hope that one 
works I recommend that you write two independent scripts, from scratch:

(1) write_to_db.py: 
Write made-up data into the MongoDB on your local machine.

(2) read_from_server.py: 
Read data from the server and print it to stdout.

Reduce these scripts to the bare minimum. Debug them one ofter another.

Once both scripts work to your satisfaction replace the sample data in 
script one with code from script two that reads actual data.

More information about the Python-list mailing list