This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If localStorage is not really required, this will at least provide storage while the app is running. | |
var storage = typeof window.localStorage !== "unknown" ? window.localStorage : { | |
getItem: function(key) { | |
return (this.items || (this.items = {}))[key]; | |
}, | |
setItem: function(key, value) { | |
(this.items || (this.items = {}))[key] = value; | |
}, | |
clear: function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
I couldn't find an example of this anywhere, so here it is. | |
This example uses Mongoose 4, where objects in an array are given their own schema automatically. | |
*/ | |
var mongoose = require("mongoose"); | |
var mySchema = mongoose.Schema({ | |
name: String, | |
things: [{ | |
_id: {auto: true, type: mongoose.Schema.ObjectId, index: true}, | |
name: String |