Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

192
Views
Why no result of db.database.find() although data is there in mongodb?

I have imported data into mongodb from csv files which has a million records using mongoimport utility:

show dbs;
admin     0.000GB
ded       0.305GB
local     0.000GB
visitors  0.000GB
db.ded.find();

Why is there no rows in the ded database when there is data of 0.305GB? How can I see this data? Any inputs on this would be great help.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

find() does not return any document because you are using the test database which does not have collection named ded.

By default, MongoDB connects to the test database and from the output of show dbs, it clear that ded is a database. To query the documents in the collections in that database, you first need to switch to it using:

use ded

Then show collections to list the collections in that database.

Also note that after switching, db is the instance of your database (here ded) so you will be querying your collection like this:

db.collectionname.find()

So if your collection's name is "flights",

db.flights.find()

See Working with the mongo Shell

over 4 years ago · Santiago Trujillo Report

0

You can use this utility (http://3t.io/mongochef/) it is easy to use and helpful for those who are new to Mongodb. While the answer to your question is the record is not showing through database name.First write db.printCollectionStats() which gives you the collection name. then use the collection name to show the data. Example db.printCollectionStats() will give you xyz then write db.xyz.find()

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!