Reputation: 27
So instead of using mongo shell directly i decided it was easier to create a json file and then just import it to monngodb, but something strange happens in the process. Heres my code:
mongoimport --db test_poke --collection testing --type json --file pokeapi.json --jsonArray
2017-09-24T23:45:44.017-0400 connected to: localhost 2017-09-24T23:45:44.624-0400 imported 4 documents
> show dbs
admin 0.000GB
anime 0.000GB
api 0.000GB
exampleDb 0.000GB
local 0.000GB
myDB 0.000GB
pokedex 0.000GB
superheros 0.000GB
test_poke 0.000GB
users 0.000GB
yUser 0.000GB
> use test_poke
switched to db test_poke
> db.test_poke.find()
> db.test_poke.find({})
// json data
{
"name": "pikachu",
"size": "small",
"element_type": "electric"
},
{
"name": "squirtle",
"size": "small",
"element_type": "water"
},
{
"name": "charmander",
"size": "small",
"element_type": "fire"
},
{
"name": "bulbasoor",
"size": "small",
"element_type": "earth"
}
no data is found i guess because nothing is returned but using anything else to CRUD works and shows results. Also I read the docs and made sure to follow their instructions but no go. Can anyone help with this? Using version 3.4.7 of mongodb.
Upvotes: 0
Views: 48
Reputation: 5652
Your collection is called testing
and is in the test_poke
database. As the comment suggests your query is wrong, and should be
db.testing.find()
Upvotes: 1