Example blog made with MongoDB



Cheap Air Max 90 Current Gray White Mens To Find With Bargain Price

View by objectId ( 531904eb62365b020032ea5f)
By Cheap Air Max 90 Current Gray White Mens To Find With Bargain Price on Thu Mar 06 2014 23:29:47 GMT+0000 (UTC)

Low-cost Air Max 95 360 Blue Mens You Choose

View by objectId ( 531658b510b34902002ea8ff)
By *******@gmail.com on Tue Mar 04 2014 22:50:29 GMT+0000 (UTC)

HiNcUOBsJMZ

View by objectId ( 531200acf751b102001d82f2)
By rodjer on Sat Mar 01 2014 15:45:48 GMT+0000 (UTC)

BrIPHQbNSOyLWcoR

View by objectId ( 50884c3e58e0a36c1d000002)
By Gordon on Wed Oct 24 2012 20:14:54 GMT+0000 (UTC)

Code sample - how all blog posts were queried

// from web.js
// main page - display all blog posts
// More Mongoose query information here
// http://mongoosejs.com/docs/finding-documents.html

app.get('/', function(request, response) {

    // build the query
    var query = BlogPost.find({});
    query.sort('date',-1); //sort by date in descending order

    // run the query and display blog_main.html template if successful
    query.exec({}, function(err, allPosts){

        // prepare template data
        templateData = {
            posts : allPosts
        };

        // render the card_form template with the data above
        response.render('blog_main.html', templateData);

    });

});
// end of main page