-
-
Save laurie71/1148291 to your computer and use it in GitHub Desktop.
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
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); | |
}); | |
}; |
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') | |
, 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); |
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
{"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