Mongoose findOne doesn't execute

I'm trying to get data but I don't know why it doesn't work

module.exports.addUser = function(firstName, lastName, userName, pwd, dob, email){      
    mongoose.connect('mongodb://localhost/testdb');

    var user = mongoose.model('user.profile', profile_schema);

    var newuser = new user();
    newuser.dob = dob;
    newuser.name.first = firstName;
    newuser.name.last = lastName;
    newuser.name.user = userName;
    newuser.pwd = crypto.createHash('md5').update(pwd).digest("hex");
    newuser.email = email;

    newuser.save(function (err) {
        if (err) console.log(err);
        // saved!
    });

    user.findOne({'email':'abc@gmail.com'}, function(err, data){
        console.log('here');
        console.log(data);
        console.log(err);
    });
    mongoose.disconnect();
};

I use this code to add user: addUser('hii','heee','sss','123456','28/05/1991','abc@gmail.com');

It's ok when the code adds data to database (no error, I checked database on console) but I can't get anything (no log is shown) even though I changed the condition

user.findOne({}, function(err, data){
            console.log('here');
            console.log(data);
            console.log(err);
        });

Can anyone help me? Thanks.

You have to move findOne function in the save callback if no err. Or add a parameter 'callback' to addUser, call it in save callback and call addUser with a function that contains your findOne.

Finally, I understood the problem. NodeJS works asynchronously; it doesn't wait for long time-consuming processes. So, in my code, if I'm careless when issuing the mongoose.disconnect command, some tasks can't finish their work. Just putting that command in the last callback of my work (findOne function callback), made everything work.

newuser.save(function (err, doc) {
        console.log('nothing');
        if (err) console.log(err);
        user.findOne({'email':'abc@gmail.com'}, function(err, data){
            console.log('here');
            console.log(data);
            console.log(err);
            mongoose.disconnect();
        });
        // saved!

    });

Thanks for everyone's help!