Is there data dictionary in mongodb like oracle?

where can i find data dictionary for mongodb??

Hello @Abumajd_Aldahab, welcome to the MongoDB forum!

You can use some of the following to get information about the MongoDB database server, its databases, collections, indexes, and the data. This is in brief, and you can use the commands or methods as per your needs. The primary tool is the MongoDB Shell, and this used for interaction with the database.

The MongoDB Shell, mongosh, is a fully functional JavaScript and Node.js 14.x REPL environment for interacting with MongoDB deployments.

You can use mongosh Methods to get information from the database. For example, some Database Methods are db.getCollectionNames(), db.listCommands(), etc.

Then, there are also Database Commands and these are run using the db.runCommand() method. For example the Administration Commands like listDatabases, listIndexes and listCollections.

Hi @Abumajd_Aldahab,

To add to @Prasad_Saya’s response: the MongoDB server has methods to get metadata information such as information about users and roles, data files and indexes, and other database metrics.

However, since MongoDB uses flexible schema there are some differences from a relational database like Oracle. For example, there is no central catalog of field names or types. Data can be validated using JSON Schema and schema can be inferred by analysis using an admin tool like MongoDB Compass: Analyse Your Data Schema.

Some related references for information you might be looking for in a data dictionary:

If you are looking for more specific details, please let us know.

Regards,
Stennie

thank you very much
I would like to know where this metadata is stored?
For example, when sending the order, show dbs
Shows all stored databases and their sizes
The question is: where is this metadata stored, is it stored in a document or is it read every time from the hard drive where the data is stored.
Thank you.

You can get the list of all databases and their collection sizes from the following, for example. This runs from mongo shell:

var dbNames = db.adminCommand({ listDatabases: 1, nameOnly: true })["databases"].map(d => d.name)
for (let dbName of dbNames) {
    let colls = db.getSiblingDB(dbName).getCollectionNames()
    for (coll of colls) {
        let size = db.getCollection(coll).dataSize();
        print(dbName + " : " + coll + " : " + size)
    } 
}

As mentioned earlier replies, you can also use db.stats or db.collection.stats methods.