Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. var mongoose = require('mongoose');
  2. var journalSchema = mongoose.Schema({
  3. title : String,
  4. journalid: {type:String, index: { unique: true, dropDups: true }},
  5. articleCount : type:Number, default:1,
  6. });
  7. module.exports = mongoose.model('Journal', journalSchema);
  8.  
  9. function updateYear(journalid, year, callback) {
  10. Journal.findOneAndUpdate(
  11. {'journalid':journalid},
  12. {$inc : {'articleCount' : 1}}, // DO SOMETHING WITH year HERE
  13. function() {
  14. callback();
  15. });
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement