# What is difference with JSON documents in postgres and Mongodb

Mongodb under the hood actually stores the data not in JSON format, but in BSON(which is more efficient in terms of memory and stores the type as well).

While in postgres, what is actually happening under the hood is it's actually a string stored in JSON document. And any SQL engine is actually storing the data and parsing with a JSON parser, but is not internally stored actually as JSON.

So this makes Mongodb approach more faster, scalable when working with JSON or any unrepresented form of data than using postgres databases.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://til.kurianbenoy.com/what-is-difference-with-json-documents-in-postgres-and-mongodb.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
