mirror of
https://github.com/sstent/expressmongotest.git
synced 2026-01-26 09:02:33 +00:00
added article
This commit is contained in:
17
test/data/schemas/user.js
Normal file
17
test/data/schemas/user.js
Normal 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;
|
||||
Reference in New Issue
Block a user