({ id: _id })
| 70 | return result.modifiedCount > 0 ? { id: _id, ...commentInfo } : null |
| 71 | } |
| 72 | async function remove ({ id: _id }) { |
| 73 | const db = await makeDb() |
| 74 | const result = await db.collection('comments').deleteOne({ _id }) |
| 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 }) |