mongodb

tiktok bookmarks

Migrating from MongoDb to PostgreSQL (Case Insensitive Sorting)

After creating a new database in PostgreSQL, I needed to connect my Node/Express application to my database. I decided to use node-postgres to do this. I followed the recommended setup for node-postgres and created a new db folder with an index.js file setting up my PostgreSQL database. After quickly testing to ensure that I was connected to the database, I began the process of updating my routes to reflect the new database.

Read
tiktok bookmarks

Migrating from MongoDb to PostgreSQL (Database Structure)

As I continued to restructure my database to accommodate user authentication, I ran into several issues. I solved some of these problems using embedded documents and aggregation. However, as I continued to learn more about databases, I came to an important realization: I misunderstood the relationships within the data I created; I incorrectly identified various relationships within my database as one-to-many.

Read
tiktok bookmarks

Using Aggregation to Work With Nested Arrays in MongoDB

After restructuring my database to accommodate user authentication, I was faced with a new challenge: displaying and manipulating information from arrays.

Read
tiktok bookmarks

Creating One-to-Many Relationships with Embedded Documents in MongoDB

After adding user authentication, I had three separate schemas for my application: a user schema, a video schema, and a list schema (that referenced videos created using the video schema). After creating an account and logging in, users could see any video or list that any user had created. However, users should have only been able to see the videos and lists that they themselves added. I had to create some sort of relationship between the user and videos and lists of videos.

Read
tiktok bookmarks

Deleting Multiple Documents In One Request With Hidden Form Input

Creating a router and a controller to delete a single video by ID was fairly straightforward. However, this method would give each video its own unique route where a user could then click to delete a video. This sounded pretty tedious, so it was important to me that users could select as many videos as they liked and then click a delete icon to remove videos from their collection of favorites.

Read