O'Reilly logo

Socket.IO Cookbook by Tyson Cadenhead

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

Loading data from MongoDB

As we are now able to send static data to our client with Socket.IO, we have all the tools we need to send dynamic data as well. MongoDB is a NoSQL database that stores data as JSON documents. In this recipe, we will send data from our database to the client side to get rendered.

Getting ready

Before you begin, you will need to install MongoDB on your machine. MongoDB can be installed by navigating to https://www.mongodb.org and following the installation steps there. Once MongoDB is installed, you can start the MongoDB server by entering mongod on your terminal window. Leave the mongod process running; you'll need to have it available to access your database.

You will also have to install a Node adapter for MongoDB. We ...

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