I have the code as below, which prints the largest partyCode:
Working:
var partyWithLargestPartyCode = Party.find().sort("-partyCode").limit(1); 
var largestPartyCode;
partyWithLargestPartyCode.exec(function(err, p) {
    largestPartyCode = p[0].partyCode;
    console.log(largestPartyCode);    
});
Output:
3
Not Working:
var partyWithLargestPartyCode = Party.find().sort("-partyCode").limit(1); 
var largestPartyCode;
partyWithLargestPartyCode.exec(function(err, p) {
    largestPartyCode = p[0].partyCode;
});
console.log(largestPartyCode);    
output:
undefined
So, I would like to make the second code block to work. How can I do that??
