Skip to main content

Amazon DocumentDB

JSON represents data in two ways

JavaScript Object Notation (JSON) is an open data interchange format that is both human and machine-readable. JSON is independent of any programming language and is a common API output in a wide variety of applications.

JSON represents data in two ways:

  • Object: a collection of name-value (or key-value) pairs. An object is defined within left ({) and right (}) braces. Each name-value pair begins with the name, followed by a colon, followed by the value. Name-value pairs are comma separated.

  • Array: an ordered collection of values. An array is defined within left ([) and right (]) brackets. Items in the array are comma separated.

Missing alt text value

JSON example

Below is a JSON example that contains an array of objects in which the objects represent different films in a streaming library. Each film is defined by two name-value pairs: one that specifies a unique value to identify that film and another that specifies a URL that points to the corresponding film’s promotional image.

json
var films = [{"FilmID":"catmanbegins", "Image":"https://m.media-amazon.com/images/catmanbegins.jpg"},
  {"FilmID":"cabdriver", "Image":"https://m.media-amazon.com/images/cabdriver.jpg"},
  {"FilmID":"pulpnonfiction", "Image":"https://m.media-amazon.com/images/pulpnonfiction.jpg"},
  {"FilmID":"doctornormal", "Image":"https://m.media-amazon.com/images/doctornormal.jpg"},
  {"FilmID":"backtothepresent", "Image":"https://m.media-amazon.com/images/backtothepresent.jpg"}];

What is a JSON document database?

A JSON document database is a type of NoSQL database that is designed to store and query data as JSON documents, rather than normalizing data across multiple tables (each with a unique and fixed structure) as in a relational database. JSON document databases use the same document-model format that developers use in their application code, which make it much easier for them to store and query data. The flexible, semi-structured, and hierarchical nature of document databases allows them to evolve with applications’ needs. JSON document databases provide powerful and intuitive APIs for flexible and agile development.

Missing alt text value

SQL vs. MongoDB terminology

The following table compares terminology used by JSON document databases (MongoDB) with terminology used by relational (SQL) databases.

Missing alt text value

What are the use cases?

Most popular uses cases for JSON document databases

A JSON document database is a great choice for content management applications, such as blogs and video platforms, because each entity can be stored as a single JSON document. If the data model needs to change, only the affected documents need to be updated with no need for schema updates and no database downtime required.

JSON document databases are efficient and effective for storing catalog information. For example, in an e-commerce app, different products usually have different numbers of attributes. These attributes can be described in a single JSON document for easy management and faster reading speed than would be possible with a relational database.

JSON document databases are a good solution for online profiles in which different users provide different types of information. You can store each user's profile efficiently by storing only the attributes that are specific to each user. JSON document databases easily manage this level of individuality and fluidity.

Being able to extract operational information in real time is critical in a highly competitive business environment. By using JSON document databases, a business can store and manage operational data from any source and concurrently feed the data to the BI engine of choice for analysis with no need to have two separate environments.