How to hide an specific field from result in strongloop

Viewed 1656

I'm trying to create an project using strongloop, in which I'm creating an web service for user login, My code runs well & gets desired output except the fact that it does not hide password

I'm getting result as

{
    "result": [{
        "_id": 2,
        "address": "abc",
        "created_by": 1,
        "created_date": "2016-03-04T00:00:00.000Z",
        "firstname": "Anup",
        "isdeleted": 0,
        "lastname": "Deshpande",
        "mobile_number": "9700128907",
        "oldpassword": "string",
        "profile_picturename": "anup.jpeg",
        "role_id": 1,
        "user_email_id": "anupd@ideaentity.com",
        "user_password": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",
        "user_status": 1
    }]
}

Where I want to hide or delete "user_password": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8", field.

can anyone tell me how can i do that in strongloop's remote method

My renote method code is like follows

db.collection('users').find({
                user_email_id : par,
                user_password : sha256(par2)
            }).toArray(function(err, result) {

                // var passwordHash = hashPassword(user_password);
                // console.log(passwordHash);
                if (err) {
                    throw err;
                }
                if (result.length > 0) {
                    self.callback(null, result);
                    // db.disconnect();
                } else {
                    self.callback(null, response);
                    // db.disconnect();
                }
            });

Here "result will give all details" I want to hide password from result

Thanks in advance

3 Answers
Related