
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.
rethink-odm
Advanced tools
Simple Object Document Mapper for RethinkDB.
npm install rethink-odm
var ro = require('rethink-odm')();
// Run command without waiting connection to be ready.
ro.run(ro.r.now()).then(function (now) {
// ...
});
// Create the model "User".
var User = ro.createModel({
tableName: 'users'
});
// Create a new User.
var user = new User({
name: 'Johnny'
});
// Create model.
user.create().then(function (user) {
// ...
});
Create a new rethinkOdm client. To know avalaible options, please refer to rethinkdb documentation.
var ro = rethinkOdm({host: 'localhost'});
Emitted when an error occurs in the connection.
ro.on('error', function (err) {});
Emitted when the client is connected.
ro.on('connect', function () {});
Emmited when the connection is closed.
ro.on('close', function () {});
Expose the rethinkdb module.
ro.r.now();
Run a command using the internal rethink odm connection. The advantage is that you don't have to wait connection to be ready.
ro.run(ro.r.now()).then(function (now) {
// ...
});
Create a new model.
var User = ro.createModel({tableName: 'users'});
It's possible to add some hooks, hook are some listeners automatically applied at initialization.
var User = ro.createModel({
tableName: 'users',
hooks: {
insert: function () {
if (! this.email) throw new Error('Email is required');
}
}
});
Return the table linked to the model.
ro.run(User.table().get('1a487dc0-f6ec-11e3-a3ac-0800200c9a66'));
Create a new instance of the model.
var user = new User({name: 'Johnny'});
Insert the model.
var user = new User({name: 'Johnny'});
user.insert().then(function (user) {
// ...
});
Emitted before the insert.
model.on('insert', function (model) {});
Emitted after the insert.
model.on('inserted', function (model) {});
Update the model.
var user = new User({
id: '1a487dc0-f6ec-11e3-a3ac-0800200c9a66',
name: 'Johnny'
});
user.update().then(function (user) {
// ...
});
Emitted before the update.
model.on('update', function (model, data) {});
Emitted after the update.
model.on('updated', function (model, data) {});
Delete the model.
var user = new User({id: '1a487dc0-f6ec-11e3-a3ac-0800200c9a66'});
user.delete().then(function () {
// ...
});
Emitted before the deletion.
model.on('delete', function (model) {});
Emitted after the deletion.
model.on('deleted', function (model) {});
MIT
FAQs
Simple Object Document Mapper for RethinkDB.
The npm package rethink-odm receives a total of 8 weekly downloads. As such, rethink-odm popularity was classified as not popular.
We found that rethink-odm 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.