0

I'm having real trouble using find in my test railwayjs app. In my model:

data is => "email":"test","password":"[FILTERED]"

Model

User.login = function(data){
    var user = new User;
    user.email = data.email;
    console.log('user email is => ' + user.email);
    user.password = data.password;
    User.find({email: user.email}, function(err, user){
        console.log(user);
    });
}

Output

user email is => test
null

Where test is in my database (mongoose running as mongod).

I really cant figure out why its coming up null..

I use user.save() elsewhere and it saves to the database fine.

I am a total rookie, so it could be something obvious, any help / pointers is massively appreciated.

edit

To add to this:

User.all(function (err, users) {
        console.log(users);
        render({
            users: users
        })
    });

works perfectly...

Andrew Plummer
  • 1,150
  • 1
  • 12
  • 21

1 Answers1

1

I've reported this as a bug on the Google Group.

Edit: It turns out that you must now do this:

User.all({ where: { email: user.email } }, function(err, user){

The documentation is available at JugglingDB Github. It should be updated in the RailwayJS website too.

Thomas Lomas
  • 1,553
  • 10
  • 22