This file contains hidden or 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
var mongoose = require('mongoose'); | |
var Schema = mongoose.Schema; | |
mongoose.connect('localhost', 'test'); | |
var schema = new Schema({ | |
_id: Number | |
, name: String | |
// etc | |
}); |
This file contains hidden or 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
var mongoose = require('mongoose'); | |
var Schema = mongoose.Schema; | |
mongoose.connect('localhost', 'testing_invitees'); | |
var userSchema = new Schema({ | |
firstName: String | |
}); | |
var U = mongoose.model('User', userSchema); | |
var eventMemberSchema = new Schema ({ |
This file contains hidden or 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
/** | |
* Module dependencies | |
*/ | |
var express = require('express'); | |
var fs = require('fs'); | |
var mongoose = require('mongoose'); | |
var Schema = mongoose.Schema; | |
// img path |
This file contains hidden or 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
var mongoose = require('mongoose'); | |
var Schema = mongoose.Schema; | |
mongoose.connect('localhost', 'testing_querybydate'); | |
var schema = new Schema({ | |
created: Date | |
, data: {} | |
}); | |
var A = mongoose.model('A', schema); |
This file contains hidden or 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
var mongoose = require('mongoose'); | |
var Schema = mongoose.Schema; | |
var assert = require('assert') | |
mongoose.connect('localhost', 'testing_findone'); | |
var schema = new Schema({ | |
name: { last: { type: String, required: true} } | |
}); |
This file contains hidden or 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
var mongoose = require('mongoose') | |
, debug = require('debug')('mongoose') | |
mongoose.set('debug', function (name, method) { | |
switch (method) { | |
case 'find': | |
case 'findOne': | |
case 'insert': | |
case 'update': | |
case 'remove': |
This file contains hidden or 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
var mongoose = require('mongoose') | |
, Schema = mongoose.Schema | |
, ObjectId = Schema.ObjectId | |
; | |
mongoose.connect('mongodb://localhost/test_update_getters_setters_defaults'); | |
var Fooschema = new Schema ({ | |
name : { type: String, default: 'foo', required: true } | |
, date : Date |
This file contains hidden or 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
var mongoose = require('mongoose'); | |
var Schema = mongoose.Schema; | |
mongoose.connect('localhost', 'testing_emitUpdate'); | |
var schema = new Schema({ | |
name: String | |
}); | |
schema.pre('save', function (next) { |
This file contains hidden or 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
var mongoose = require('mongoose'); | |
mongoose.connect('localhost', 'testing_populatedGetter'); | |
var Schema = mongoose.Schema; | |
var UserSchema = new Schema({ | |
name: { | |
first: { | |
type: String | |
}, |
This file contains hidden or 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
var mongoose = require('mongoose'); | |
var Schema = mongoose.Schema; | |
var db = mongoose.connect('localhost', 'testing_nestedQueryPositional'); | |
var schemaObjectId = Schema.ObjectId; | |
/** | |
* Model: Estimate Line Item | |
*/ | |
var EstimateLineItemSchema = new Schema({ |