These are chat archives for Automattic/mongoose

Nov 2015
James Lee
Nov 18 2015 06:13
don't think there's an "official" way
he introduced a .delete method
looked at another too, they pretty much do the same
i don't see how this will prevent from .find though
but easy enough to add filter {deleted: false}
Valeri Karpov
Nov 18 2015 15:15
@diegoaguilar no official plugin at the moment. I typically end up writing a plugin that adds a 'isDeleted' field to a doc and attaches a bunch of pre() hooks to query operations to attach isDeleted: false unless I specify a showDeleted option to the query. It's a 15-liner, not too tricky. Would it be useful if I open-sourced that?
Nov 18 2015 15:19
would the plugin record who deleted the doc ?
Valeri Karpov
Nov 18 2015 15:21
nope that's not something my implementation does. Beauty of open source though, somebody could always contribute that.
Diego Aguilar Aguilar
Nov 18 2015 15:30
@vkarpov15 have u got a repo for ur plugin?
oh, I just read your first comment, yeah it would be useful if u open source it :)
Refael Dakar
Nov 18 2015 21:53
Hey, sorry for the (maybe) stupid question but I couldn't find where it says if mongoose automatically detects PRIMARY in case the SECONDARY becomes the PRIMARY?