0

I haven't done much with MongoDB. But in trying to understand the data that we do have in MongoDB, it makes sense to start with looking at the DDL in the database. What is the simplest way to pull the DDL out of the MongoDB database. I can log directly onto the Linux server and run commands, plus I have the Robo 3T client.

Thanks

3

MongoDB doesn't have Data Definition Language. In place of "rows" and "columns" it has "objects" and "attributes". An object is typically not defined or constrained by the storage engine as it would be in a relational database.

The data is not defined by the thing that keeps it but rather by the thing that reads and writes it. For this reason, you can store data about an "Employee" object in the same collection where you also store data about a "Transaction" object. The storage engine won't stop you unless you tell it to.

For MongoDB the Data is Defined by the application, not the database. So you need to go to the application to understand what the equivalent of "DDL" is for the application. Anything you infer from the database is anecdotal and not rigorously constrained.

| improve this answer | |
  • In Mongo does not use "objects" and "attributes", they use terms documents and fields, see Documents And collection which correspond to "table" in relational databases. – Wernfried Domscheit Oct 3 at 10:46
1

MongoDB has databases, collections and documents. These are analogous to databases, tables and rows in a SQL / tablular database. Then there are indexes and views which are similar to that of the SQL databases.

You can inquire into an installation for these objects. Typically, using a client tool. The main client is the command-line mongo shell. You can query the data definitions as well as the data using commands or methods. Here are the shell methods, which includes the administrative methods: mongo Shell Methods.

The shell methods can also be run as commands: Database Commands.

You can also use the MongoDB Compass GUI tool to view the databases, collections, document structure (field types, etc), and indexes. For example view databases: Compass - Databases.

You will find this useful: SQL to MongoDB Mapping Chart.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.