From the course: Advanced Node.js: Scaling Applications

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Setting up horizontal partitioning

Setting up horizontal partitioning - Node.js Tutorial

From the course: Advanced Node.js: Scaling Applications

Start my 1-month free trial

Setting up horizontal partitioning

- [Instructor] Let's take a look at how we can modify the node local storage database to partition data between two databases. I'm looking at the exercise files in chapter two, chapter two lesson four and within the start folder I'm currently looking at the index. So here we're using a database module that we've created and this is a database of cats. So we'll go ahead and save the names and colors of all of these cats, so every time we call db add cat we'll be adding a new cat to the database. On line 10 were gonna read a cat named Biscuit from the database, so it should find the first cat that we've added and then on line 11 we're supposed to get an array of all of the orange cats. So it should get these last two cats here on line seven and eight and the one on line three. So we're writing to the database with add cat and then reading from it with find cats by name and find cats by color. Then finally we're just logging that information here. So let's go to the terminal and run…

Contents