Blog


Using Mongoose with Node.js to Add Documents into a MongoDB Collection and For Loops to Display Document Fields
Posted on July 20, 2015 in MongoDB, Node.js by Matt Jennings

// require path
var path = require(“path”);

// require express and create express app
var express = require(“express”);
var app = express();

// Require body-parser …

Read more


JavaScript Function to Find the Longest Common Prefix
Posted on July 20, 2015 in Algorithms, JavaScript by Matt Jennings

In a JavaScript array, find the longest common prefix of all array elements.

function longestCommonPrefix(arr){
// sort() method …

Read more


MongoDB Array Operators
Posted on July 17, 2015 in MongoDB by Matt Jennings

db.schools.update( {name: “San Jose”}, {$push: {amenities:{$each: [“onsite dorm”, “cafeteria”, “pool”] } } } )

db.schools.update( {name: “San Jose”}, {$push: {amenities: “hot …

Read more


MongoDB Query Selector Comparison Operators
Posted on July 17, 2015 in MongoDB by Matt Jennings

Quote from http://docs.mongodb.org/manual/reference/operator/ on July 17, 2015:

Query operators provide ways to locate data within the database and projection …

Read more


Basic MongoDB Terminal Commands
Posted on July 17, 2015 in MongoDB by Matt Jennings

After installing MongoDB, below are some basic terminal commands.

Open a terminal window, become a root user, and do:
mongod …

Read more