howdyai / botkit-storage-mongo

A MongoDB storage driver for Botkit
MIT License
54 stars 42 forks source link

Make Delete take data, not an id. #32

Closed Laptopmini closed 6 years ago

Laptopmini commented 6 years ago
delete: function(id, cb) {
    return table.findOneAndDelete({id: id}, cb);
}

Could this be changed to the following?

delete: function(data, cb) {
    return table.findOneAndDelete(data, cb);
}

That way we can use it in the following manner:

controller.storage.users.delete({ something: { $lt: 30 } }).catch((error) => {
    console.log(error);   
});

Thanks for all the great work!

Laptopmini commented 6 years ago

Done. PR #33