Skip to content

Instantly share code, notes, and snippets.

@laurie71
Forked from blissdev/api.js
Created August 16, 2011 02:00
Show Gist options
  • Save laurie71/1148291 to your computer and use it in GitHub Desktop.
Save laurie71/1148291 to your computer and use it in GitHub Desktop.
exports.updateCollection = function(req, res, next) {
console.error('REQUEST UPDATE for: ', req.params.collection);
console.error('UPDATE DATA\n', req.body);
Collection.update({ _id: req.params.collection }, req.body, {}, function(err, collection) {
if (err) {
console.error('UPDATE FAILED:', err.stack || err);
return next(err);
}
console.error('UPDATE OK, updated:', collection);
res.send(collection);
});
};
var mongoose = require('mongoose')
, Schema = mongoose.Schema
, ObjectId = Schema.ObjectId;
var collectionSchema = new Schema({
hall: ObjectId,
parent: ObjectId,
position: Number,
label: String,
haslayout: { type: Boolean, default: false }
});
module.exports = mongoose.model('Collection', collectionSchema);
{"haslayout":true,"label":"Basement","hall":"4e36466c976e005003000004","_id":"4e4895a913d9adf5f5000006"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment