I use MongoDB and I connect to it through pymongo. Here's my code:
>>> import pymongo
>>> con=pymongo.Connection('localhost',27017)
>>> con.database_names()
['local', 'bookdb']
>>> con.close()
>>> con.database_names()
['local', 'bookdb']
I use con.close()
to disconnect to the MongoDB, but after that, I can still use con.database_names()
to see the list of the databases. Why? it never disconnect to the MongoDB server. Why the close()
not work?