是否可以限制每个用户的文档数? 例如:1个用户只能创建3个文档
添加公司
example.json
});
这是通用模式
companyRoute.route('/create').post((req, res, next) => {
var postData = req.body;
postData.creator = req.userId;
console.log('here is post data for message: ');
console.log(postData);
var post = new Company(postData);
post.save((err, result) => {
if (err) {
console.error('error saving post error');
return res.status(500).send({ message: 'error saving post message' });
}
console.log('New post has been saved.');
res.status(200).send({ newPost: post._id });
});