how to store signup data into redis with node.js

i want to store signup data it contains name and email and password. i will store this data in mongodb like this

db.save({"name":"xxxx","email":"xxxxx","password":'xxxxxxxx'},function(err,result){});

when user login ,they surely give their email id or username with password so i will find this user exist in db or not by using like this

 db.find({'email:'xxxxxxx','password':'xxxxxxxxx'},function(err,result){});

i have tried to do same in redis,by like this

    db.hmset('key' name xxxxx email xxxx pass xxxxxx,function(){});

it is stored but how can i check email id usename already exist becz user will give email and password only.if i know key then only i can find that data.even if i know key i can get only data i could not be found data already exist ot not like mongodb

how can i solve this?

You could store your users both in a Set and a Hash for details.

You can then check in the Set if a user exists with: http://redis.io/commands/sismember

I think you should break things down into chunks instead of trying to do everything with one query. So, for example, to add a new user, first check if the user exists:

(My example assumes a Mongoose User Model has been defined)

User.findOne({$or : [{'email': req.body.email}, {'username': req.body.username}], 
function(err, result) {
   if (err) {next(err);}
   if (result) {
      // you found an existing user
      res.send(309, {'message':'Error: User exists'});
   } else {
      // no user found
      var user = new User({
         'email': req.body.email,
         'username': req.body.username,
         'password': req.body.password,
         'and-so-on': req.body.moredata 
      });
      user.save(function(err){
         if (err) {next(err);}
         res.send(200, {'message':'User Registered Successfully'});
      });
   }

Honestly though, I wouldn't recommend writing a user authentication system from scratch, because it is pretty limiting in todays world of auth methods. I personally use Passport, because it gives you the ability to use multiple auth systems with your app, including Facebook, Twitter, and so on and so forth.