MongoDB - 显示数据库中的所有文件

MongoDB - show all files in a db

我正在尝试使用 pymongo 将上传的文本文件插入数据库,然后将其显示在 webapp 上。我试图显示文件是否已插入数据库 (MongoDB)。如何检查文件是否已插入 MongoDB shell?

在 Mongo shell 中,您可以先切换到刚刚导入的数据库:

use db_name

如果您不知道数据库名称,请检查现有数据库:

show dbs

然后查询文档集合:

db.coll1.find()

其中 coll1 是集合名称。

如果您不知道集合名称,请检查现有集合:

show collections

如果你使用了insert() method and you want to immediately check completed successfully, you can check method's result.