mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-09-22 04:55:47 +08:00
use countDocuments
This commit is contained in:
parent
4e54ab5a6b
commit
268fbddc95
1 changed files with 18 additions and 14 deletions
|
@ -30,24 +30,26 @@ module.exports = server => (path, session, callback) => {
|
|||
return callback(null, 'NONEXISTENT');
|
||||
}
|
||||
|
||||
db.database
|
||||
.collection('messages')
|
||||
.find({
|
||||
db.database.collection('messages').countDocuments(
|
||||
{
|
||||
mailbox: mailboxData._id
|
||||
})
|
||||
.maxTimeMS(consts.DB_MAX_TIME_MESSAGES)
|
||||
.count((err, total) => {
|
||||
},
|
||||
{
|
||||
maxTimeMS: consts.DB_MAX_TIME_MESSAGES
|
||||
},
|
||||
(err, total) => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
db.database
|
||||
.collection('messages')
|
||||
.find({
|
||||
db.database.collection('messages').countDocuments(
|
||||
{
|
||||
mailbox: mailboxData._id,
|
||||
unseen: true
|
||||
})
|
||||
.maxTimeMS(consts.DB_MAX_TIME_MESSAGES)
|
||||
.count((err, unseen) => {
|
||||
},
|
||||
{
|
||||
maxTimeMS: consts.DB_MAX_TIME_MESSAGES
|
||||
},
|
||||
(err, unseen) => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
@ -58,8 +60,10 @@ module.exports = server => (path, session, callback) => {
|
|||
uidValidity: mailboxData.uidValidity,
|
||||
unseen
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue