Kamva/mgm

[New-Feature] DeleteMany by Filter

gigi214 opened this issue · 2 comments

Firstly, congratulation guys, it's a great project.
I've got an idea to enhance it.

Is your feature request related to a problem? Please describe.
I'd the necessity to delete many documents following some filters. Impossibile to do it with the current lib. I just delete a single document per time. and it's very annoying to making a lot of "get" and the related "delete".

Describe the solution you'd like
It would be great if I could use a query like in the Find operation to delete more than one document per time. Also following the same rules for the filter that accepts the official driver.

Describe alternatives you've considered
The only alternative that I found is to use the mongodb official driver.

Hi @gigi214,
we're glad that you like it :)

mgm is a wrapper around the official MongoDB driver, it supports all MongoDB features.
Any filter that you can use in the MongoDB official driver, you can use it here too.
e.g.,

mgm.Coll(&Book{}).DeleteMany(context.Background(),bson.M{"name":"example_filter"})

Oh Sorry, I didn't figure out this possibility.
Thanks @mehran-prs.