Skip to content
Expertalks
JavaScript CSS
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
scripts
yellow-pages
.gitignore
README.md

README.md

Expertalks-November2013

Why my MongoDB is slow?

This ExpertTalks focuses on the slow performance of MongoDB in the absense of indexes or incorrect indexes. This Git repo contains the example appliction which contains skeleton of a Yellow Pages applications using Node.js and MongoDB.

The presentation can be found at http://prezi.com/jmsea2wgrtr_/why-is-my-mongodb-slow/

Using scripts to generate data

  • Go to scripts folder.
  • Make sure your MongoDB is running on localhost and port 27017.
  • Run following command to open mongo shell>mongo expertalks_demo
  • Load listingGenerator.js using : >load('listingGenerator.js')
  • Generate lot of listings >createListings(1000000)
  • Now you should get a listings collection with 1 million documents.
  • Verify the data using: db.listings.findOne()
  • You should see a listings document with title, averageRatings, category, description, address and reviews.

The schema of our listing is as bellow:

{
    "title" : "Anand's pizza",
    "description" : "Some information",
    "address" : {
        "city" : "Pune",
        "state" : "Maharashtra"
    },
    "averageRating" : 4.0,
    "category" : "food",
    "reviews" : [
        {
            "title" : "Very good food",
            "content" : "I like this pizza",
            "rating" : 4.0,
            "postDate" : ISODate("2013-11-13")
        }
     ]
}

Running the Yellow Page app

The Yellow Page test application is built using Node.js and Express. To start the app

  • Navigate to yellow-pages directory
  • Install Node modules using npm as >npm install
  • Run following command to start Express server.
    >node app.js
  • By default the Express server will start on port 3000
  • Open browser and navigate to http://localhost:3000/
  • You should now see the home page of Yellow Page test application
Something went wrong with that request. Please try again.