ex90rts / koa-mongoose Goto Github PK
View Code? Open in Web Editor NEWKoa and Mongoose Example
License: MIT License
Koa and Mongoose Example
License: MIT License
文件位置:models/users.js
代码:
//使用middleware,每次保存都记录一下最后更新时间
User.pre('save', function(next){
this.updated = Date.now();
next();
});
问题:
不应该在 save 内更新 updated,save 只会在初始化当前 Model 的时候执行,update 的时候是不会执行的
Good day.
Could you please make your comments in english.
Step 1: Add the library
Include via CDN:
<script src="https://cdnjs.cloudflare.com/ajax/libs/airbrake-js/1.4.6/client.min.js"></script>
We also support installation via npm or Bower.
Step 2: Copy this config snippet to your app.js
file
(You can find your project ID and API KEY with your project's settings):
var airbrake = new airbrakeJs.Client({
projectId: <Your project ID>,
projectKey: '<Your project API Key>'
});
To test that Airbrake has been installed correctly in your JavaScript project, just open up the JavaScript console in your internet browser and paste in:
window.onerror("TestError: This is a test")
Visit our official GitHub repo for more info on alternative configurations and advanced options.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.