Closed TheWrongAlice closed 6 years ago
Hi @TheWrongAlice
It's a nice idea and definitely would save some boilerplate for others, but it crosses driver / ORM library boundary a bit - we typically avoid this library dictating any document content and keep it strictly on the driver side for maximum flexibility.
I fully agree it's of great use to a lot of people though - have you considered wrapping it up as an ORM package that builds on top of mgo? A mongo ORM could go down rather well.
Thanks for taking the time to open a PR though, it's genuinely appreciated!
Dom
I made this for use in my project, I don't know if it's something you want maybe?
If
Collection.UsesSoftDelete
flag is set to true, it changes the behaviour for functionsFind
,FindId
,Remove
,RemoveId
,RemoveAll
.Remove functions will not delete from database, instead they add a new property
deleted: true
. Find" functions will ignore all that has thedeleted: true
flag. I plan to expand this with anRestore
function that removes the deleted flag.Also I could not figure out how to run the unit tests for my own repo, but I guess this pull request will run them for me :ok_hand: