Skip to content

Instantly share code, notes, and snippets.

@luojiyin1987
Last active July 3, 2018 10:31
Show Gist options
  • Save luojiyin1987/df2ced13705d62c79ab2422f605a63c9 to your computer and use it in GitHub Desktop.
Save luojiyin1987/df2ced13705d62c79ab2422f605a63c9 to your computer and use it in GitHub Desktop.
[nodejs mongoose 想获得find的值] #异步
function couldSendSMS(mobile) {
SMSLog.model.find()
.where('mobile', mobile)
.sort({ expiredate: -1 })
.limit(1)
.exec( function (err, smsLogs) {
console.log("find ok");
return (smsLogs[0].expiredate < Date.now());
});
}
var isNeedSend = couldSendSMS(mobile); //为什么isNeedSend 是undefine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment