Skip to content

Instantly share code, notes, and snippets.

View elberthcabrales's full-sized avatar

elberth elberthcabrales

View GitHub Profile
@elberthcabrales
elberthcabrales / mochatutorial.md
Created November 14, 2017 03:20 — forked from soheilhy/mochatutorial.md
Mocha Tutorial

Testing Node.JS applications using Mocha

Mocha is a unittest framework for Node. In this document, we explain how you can test your javascript code and also your HTTP servers.

Installing Mocha

Use npm to install Mocha:

npm install mocha
@elberthcabrales
elberthcabrales / mongoose-ref-model-service.js
Created January 19, 2018 01:03 — forked from arahmanali/mongoose-ref-model-service.js
Mongoose nested query on Model by field by its referenced model.
/*
Find all companies that people with lastname "Robertson" have founded
*/
var mongoose = require('mongoose');
var PersonSchema = new mongoose.Schema {
firstname: String,
lastname: String
};
var Person = mongoose.model('Person', PersonSchema);