MongoDB for Java developers: quick introduction

MongoDB is a database for JSON objects (it can do even more), which are called "documents".

A collection of JSON documents is called "collection" (which is similar to a RDBMS table).

JSON is, in Java terms, a tree data structure based on a key-value-map like Map<String, Object> (org.bson.Document implements Map<String, Object>) with:

  • String
  • double
  • boolean
  • Map<String, Object> (recursively)
  • Arrays (of the previous elements, even recursively).

as possible values.

MongoDB belongs to the NoSQL category of databases. (Note: Even relational databases like support JSON too.) It can do various querying operations.

See https://www.mongodb.com/docs/drivers/java/sync/current/quick-reference/ for a quick reference how to use it in Java.

MongoDB in the JavaScript world

In the JavaScript world JSON is a central thing, be it in the language itself, the front end or back end. Therefore MongoDB, as a JSON database, is a storage for a native object.


To view or add a comment, sign in

More articles by Bojan Antonović

Explore content categories