mongodb how to get current logged in user
<p>I can successfully get all the users but what I need is to get the logged in user's detail. <code>.find()</code> find everyone in the DB is there a specific func to get the current user? I thought <code>User.getUser()</code> mongodb func would identify the currently logged in user but apparently not.</p>

<p>I'm creating a user profile page for this logged in user.</p>

<p>Login </p>

<pre><code>module.exports.login = function (req, res){
 User.find(req.body, function (err, results){
    if (err) throw err;

    var jsonToken = {
        username: req.body.username,
        expiry: new Date().toISOString()
    }
    var encryptedData = btoa(JSON.stringify(jsonToken));
    console.log(encryptedData);

    if (results &amp;&amp; results.length === 1){
        res.json(encryptedData);
    }

   })
}
</code></pre>

<p>Get user</p>

<pre><code>module.exports.getuser = function (req, res) {
console.log('get current user detail');
User.find(req.body, function(err, result) {
    if(err) throw err;

    if(result) {
        console.log(result);
        res.json(result);
    }
})
}
</code></pre>

<p>Angular Ctrl</p>

<pre><code> var getUser = function() {
        signupService.getUserDetail()
            .then(function(response) {
                console.log(response.data);
            });
    }
</code></pre>