Skip to main content

Posts

Showing posts from December, 2021

Flexible Query and Indexing for Flexible JSON Model

  Use N1QL when you're in a JSON pickle. - Confucius For the JSON data model, the general advice is to think of collections as tables, JSON documents as denormalized rows, and field names as columns — roughly. All this holds true in databases like Couchbase and MongoDB when recommendations are strictly followed. There are many reasons why users don't simply follow this key-value pair model  all the time.  Here are the main reasons: You want to convert a map/hashmap data structure where the keys are dynamic. Timeseries data when the field names are usually encoded timestamps. Dictionary based encoding . Existing document formats and standards disallow redesign. If your database and query language the query language doesn't deal with the situation, you've to go through an elaborate redesign. In addition to simply accessing the information, how do you make the queries on JSON efficient when you don't even know the name of the field you have to index on? Fortunately, Co...