databasemongodbstudio3t

MongoDB not returning the Data


I created a database using MongoDB named mydb. Then I created a collection called coll3

use mydb
db.coll3.insert({"1":"HI"})

When I do this

db.coll3.find()

I get this error

Couldn't retrieve documents

java.lang.IllegalStateException cannot be cast to t3.utils.document.g


Solution

  • You need to pass the query object (an empty object to return all documents) to the find function:

    db.coll3.find({})
    

    Refer to the MongoDB documentation.