O'Reilly logo

Continuous Integration, Delivery, and Deployment by Sander Rossel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Putting the Shopping Cart in MongoDB

The only thing left to do before we are completely backend driven is to add functionality for adding and removing products from the shopping cart and remembering them. First, some rules. When you are trying to buy something while you are not logged in, you will be taken to the login page. When you go to the shopping cart page, you will also be taken to the login page and, when you log in, you will be taken to the shopping cart page. When you buy something, it will be added to your shopping cart and it will be remembered across sessions. That is really how easy it is.

First, let's create a function that gets us the logged in the user's shopping cart from the database. I am going to show the relevant backend ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required