1.

How are recursive queries supported within MongoDB?

Answer»

BSON is a binary JSON. Inside the database, there is a need for binary representation for efficiency.

There are 3 major reasons for preference to BSON:

  •  FAST Scannability - In Mongo, we know documents can be quite large. BSON HELPS to skip undesired portions of documents thus enabling fast scannability.

Example: In below document, we have a large subdocument named hobbies, now suppose we want to query FIELD "active" skipping "hobbies" we can do so in BSON due to its linear serialization property.

{-ID: "32781",    name: "Smith”, age: 30, hobbies: { .............................500 KB ..............},  active: "true”}
  • Data types - BSON provides several EXTRA data types than BSON like Data datatype, Bin data datatype, Object Id datatype etc.
  • Compact Storage - Data is stored in a compact manner (binary format), utilizing less space. Also, data movement from client to server and vice-versa is in BSON format thus securing data on the fly. Data can then be converted to JSON format at the client side using a custom program or MongoDB drivers.


Discussion

No Comment Found