(comment)
| 75 | return result.deletedCount |
| 76 | } |
| 77 | async function findByHash (comment) { |
| 78 | const db = await makeDb() |
| 79 | const result = await db.collection('comments').find({ hash: comment.hash }) |
| 80 | const found = await result.toArray() |
| 81 | if (found.length === 0) { |
| 82 | return null |
| 83 | } |
| 84 | const { _id: id, ...insertedInfo } = found[0] |
| 85 | return { id, ...insertedInfo } |
| 86 | } |
| 87 | } |