Notes on JSON Modeling for Document Databases

Search for a command to run...

No comments yet. Be the first to comment.
A quick cheatsheet for TMUX commands that I can never remember. tmux yum -y install tmux Out of tmux new session tmux new new session with name tmux new -s sessionname show sessions tmux ls attach to session tmux attach-session -t 0 Go to last sessi...
Here's a fun error: "not syncing vfs unable to mount root fs on unknown block" I'm running CentOS7 on Linode and happened to run into this error on one of my systems. Quite unusual, so I did the quick and dirty method and restored a backup of my VM....
I discovered a fun git command that I wasn't aware of before. git switch -c <new-branch> Using git switch, you can take existing, uncommitted files and move them to a new branch. Say you're working in the master branch and want to move those changes...
Well, maybe not so hidden, but definitely not advertised. Vudu has an API that, for the life of me, I could not find advertised anywhere, even with an advanced Google search. So, I'll take it upon myself to scrape their webpage and dissect their ho...
I didn't realize until recently that you can run DynamoDB on a local machine on either Windows, Mac, or Linux. This obviously can be hugely benefitial for learning and dabbling in DynamoDB, without racking up a large AWS bill. Let's see if we can get...
Notes from a presentation by https://twitter.com/mgroves . Replay available https://www.youtube.com/channel/UC5Cjdv38sS_yNEue-QUAF7g
Agenda:
"Change is inevitable" and relational databases don't handle change as well. NoSQL databases scale much easier
Types of NoSQL Databases:

No inherent relationship between data. Provides flexibility
Performance
Use Cases: Caching, session, user profile, content management Other users: gaming, advertising, travel booking, loyalty programs, fraud monitoring, social media, finance, customer 360, IoT, communication
Properties of Real-World Data: example: customer

The old way of relational databases:
As schemas get more complex, it gets harder to add tables and columns.
RDBMS vs DocumentDB:
Standard Customer table:

Introduce another table:

RDBMS would require a "Join" at this point, but with the document model, it's still just one piece document
Adding more rows is easy by adding items to the array
(quotes are not optional for valid JSON)
Creating the connections array refers to another document with a documentkey ID.

The full model:


Ways to control documents: You can version documents with different ways to break out the model Does not require a change to pk or fk.

Can also reversion with a web application. Get data from old document and save it to the new (user initiated)
Tools to help with modeling

jsoneditoronline.org is the only free one.
SQL is accessed via SQL Query. NoSQL has many many options to access. -
Example using C#:

Recommendations for keys:
Deterministic means that a "march" through the data makes sense.

Example: Find author, pull up author's blogs, go to blog posts, pull blog posts comments
Relationships:

Update via subdocument api, can speed up updates without accessing the whole document

N1QL (SQL for Document DB) Example:

Search with index and use suggestions to improve performance.
Full Text Search - find all the results that have the word you're looking for

Good for lots of things like inverted index, geographical

Use the right concept to access the data, and model the data accordingly.

Tools:


Do it with a simple CSV output and import. Once data is in place, start using or transforming that data into a future state.

Align your data with the ways you want to access it.
CouchBase ships with samples.
Demo showed creating a bucket and running a C# program to convert the data from SQL Server to Couchbase. Bucket contains Scopes, Scopes contain collections, collection contains documents