AutoTester213
AutoTester213

Reputation: 2862

MongoDB - show all files in a db

I am trying to insert a uploaded text file into database using pymongo and then display it on the webapp. I am trying to show if the files are inserted in the database (MongoDB). How can i check if a file has be inserted in MongoDB shell?

Upvotes: 1

Views: 2884

Answers (2)

deniska369
deniska369

Reputation: 241

If you used insert() method and you want to immediately check completed successfully, you can check method's result.

Upvotes: 0

elena
elena

Reputation: 4188

In the Mongo shell you could first switch to the database you've just imported:

use db_name

If you don't know the database name, check the existing databases:

show dbs

Then query the collection for the documents:

db.coll1.find()

where coll1 is the collection name.

If you don't know the collection name, check the existing collections:

show collections

Upvotes: 4

Related Questions