
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
modelis-monk
Advanced tools
monk plugin for modelis.
connection (required)
collection (required)
option (optional)
createdupdatedvar Modelis = require('modelis');
var monk = require('modelis-monk');
// define.
var User = Modelis.define('User').attr('name').attr('age');
if (simple) {
// use.
User.use(monk('localhost/test', 'users'));
// User.Repository available.
User.Repository.drop(function() {});
// methods available.
new User({}).insert(function() {});
}
if (customize) {
// use.
User.use(monk('localhost/test', 'users'), {}, function(Repository, methods) {
this.Store = Repository;
this.prototype.save = function() {
if (this.primary() === undefined) {
return methods.insert.apply(this, arguments);
} else {
return methods.update.apply(this, arguments);
}
};
this.prototype.remove = methods.remove;
});
// User.Store available.
User.Store.drop(function() {});
// methods available.
new User({}).save(function() {});
}
var Modelis = require('modelis');
var monk = require('modelis-monk');
// define.
var User = Modelis.define('User').attr('name').attr('age');
// use.
User.use(monk('localhost/test', 'users'));
// connection.
User.Repository.connection(); //=> monk connection.
// collection.
User.Repository.collection(); //=> monk collection.
// insert.
new User({ name: 'john', age: 19 }).insert(function(err, success) {
// find.
User.Repository.findOne({ name: 'john' }, function(err, user) {
// update.
user.set('name', 'bob').update(function(err, success) {
// remove.
user.remove(function(err, success) {});
});
});
});
var Modelis = require('modelis');
var monk = require('modelis-monk');
var co = require('co');
// define.
var User = Modelis.define('User').attr('name').attr('age');
// define plugin.
User.use(monk('localhost/test', 'users'));
co(function*() {
// insert.
var inserted = yield new User({ name: 'john', age: 19 }).insert();
inserted.get('name'); //=> john
// find.
var found = yield User.Repository.findById(inserted.primary());
found.get('name') //=> john
// update.
yield found.set('name', 'bob').update();
var updated = yield User.Repository.findById(found.primary());
updated.get('name') //=> bob
// remove.
yield updated.remove();
var removed = yield User.Repository.findById(updated.primary());
removed === null; //=> true. `updated` was deleted.
})();
FAQs
monk plugin for modelis.
We found that modelis-monk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.