1

我在这里想念什么?导入了 300 个对象,但我用 find() 看不到它们

导入 JSON 文件:

mongoimport --host localhost -db foo -collection bar --file onebigline.json
connected to: localhost
Tue Sep 11 10:36:58 imported 300 objects
MongoDB shell version: 2.2.0

启动 Mongo

connecting to: test
> show dbs
foo 0.203125GB
local   (empty)
> use foo
switched to db foo

显示从 db foo 导入的 JSON 数据

> db.foo.find()
>
4

1 回答 1

4

mongoimport您来自命令的集合名称是bar,不是foo,所以请尝试:

> db.bar.find()
于 2012-09-11T14:52:19.700 回答