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
var mongoose = require('mongoose'); | |
mongoose.connect('mongodb://localhost/test'); | |
var Schema = mongoose.Schema; | |
var PageSchema = Schema({ | |
title: { type: String, default: '', trim: true }, | |
url: { type: String, default: '', trim: true }, | |
thumbnails: {type: Schema.ObjectId, ref: 'Thumbnail'}, | |
}); |
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
//Question: | |
// Environment: NodeJS | |
// Lets suppose that you have a collection of items, and your function must persist all items using the | |
//database.insert(item, callback ) function. When you finish the task, you should call the callback function. | |
// If one item raise a error, the callback(err) must be called and never call the callback anymore. | |
function noop() {} |