node package manager

modis

Mongoose-like models for Redis.

modis

Mongoose-like models for Redis.

Install modis.

npm install modis --save

Make a new 'User' model.

const modis = require("modis");
 
var modis = require("./index.js");
 
modis.connect();
 
var User = modis.model("user", {
    password: String,
    age: Number
});

Create a new User!

var monty = new User("montyanderson", {
    password: "nodejsisthefuture",
    age: 99
});
 
console.log(monty);
$ node test.js
{ password: 'nodejsisthefuture',
  age: 99,
  _id: 'montyanderson',
  _key: 'user:montyanderson' }
 

Save the user!

monty.save(function(err) {
    console.log(err || "Model saved!");
});
User.find("montyanderson", function(errdata) {
    console.log(err || data);
});

You can also fetch multiple objects at a time, like this.

User.find(["montyanderson", "user1", "user2"], function(errdata) {
    console.log(err || data);
});