From the course: Advanced Node.js: Scaling Applications
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Setting up horizontal partitioning - Node.js Tutorial
From the course: Advanced Node.js: Scaling Applications
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.