Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var mongoose = require('mongoose');
- var journalSchema = mongoose.Schema({
- title : String,
- journalid: {type:String, index: { unique: true, dropDups: true }},
- articleCount : type:Number, default:1,
- });
- module.exports = mongoose.model('Journal', journalSchema);
- function updateYear(journalid, year, callback) {
- Journal.findOneAndUpdate(
- {'journalid':journalid},
- {$inc : {'articleCount' : 1}}, // DO SOMETHING WITH year HERE
- function() {
- callback();
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement