Showing
1 changed file
with
3 additions
and
3 deletions
| ... | @@ -84,11 +84,11 @@ const transPublishingTopicAndMessage = async(bottleId) => { | ... | @@ -84,11 +84,11 @@ const transPublishingTopicAndMessage = async(bottleId) => { |
| 84 | const topic = 'bottle/' + bottleId + '/stb'; | 84 | const topic = 'bottle/' + bottleId + '/stb'; |
| 85 | 85 | ||
| 86 | const bottleMedicine = await BottleMedicine.findOne({ bottleId, useYn : 'Y' }); | 86 | const bottleMedicine = await BottleMedicine.findOne({ bottleId, useYn : 'Y' }); |
| 87 | - const takeMedicineHist = await TakeMedicineHist.find({ | 87 | + const takeMedicineHistList = await TakeMedicineHist.find({ |
| 88 | bmId : bottleMedicine._id | 88 | bmId : bottleMedicine._id |
| 89 | - }).sort({ takeDate : 'asc' })[0]; | 89 | + }).sort({ takeDate : 'asc' }); |
| 90 | 90 | ||
| 91 | - const message = 'res/' + await transDate(takeMedicineHist.takeDate) + '/' + bottleMedicine.dosage; | 91 | + const message = 'res/' + await transDate(takeMedicineHistList[0].takeDate) + '/' + bottleMedicine.dosage; |
| 92 | 92 | ||
| 93 | return { | 93 | return { |
| 94 | topic, | 94 | topic, | ... | ... |
-
Please register or login to post a comment