added article

This commit is contained in:
2013-01-16 20:44:56 -05:00
parent ef1226aef6
commit a899234e21
44 changed files with 16300 additions and 20 deletions

17
test/data/schemas/user.js Normal file
View File

@@ -0,0 +1,17 @@
var mongoose = require('mongoose');
var UserSchema = new mongoose.Schema({
username: {type: String, unique: true},
name: String,
password: String,
});
UserSchema.methods.recentArticles = function(callback) {
return this.model('Article')
.find({author: this._id})
//.sort('created_at', 1)
.limit(5)
.exec(callback);
};
module.exports = UserSchema;