These are chat archives for Automattic/mongoose

Nov 2017
Nov 22 2017 08:47
is there a way to get the _id of an array of already populated documents?
an array of _ids from that array of already populated documents
Juha Lindstedt
Nov 22 2017 08:54 => doc._id)
Steve P. Sharpe
Nov 22 2017 15:07
I’m trying to allow soft delete on my models which works using mongoose-delete plugin. I seem to be having issues with unique fields, such as username. Originally I just had a unique index on username, now I’m using a compund index on both username and deletedAt. However if I get a fail on the username, I also get a fail on deletedAt. Is there a better way to do this? Thanks
Dennis Belany
Nov 22 2017 19:26
What fail
Steve P. Sharpe
Nov 22 2017 19:30
@azarus Thanks for being so friendly, jeez. The fail I was referring to was to do with it being a unique compound index. I’m using this schema.index({ username: 1, deletedAt: 1 },{ unique: true });The reason for this is because having just unique on the username, it was still checking the soft deleted items. I basically want to unique usernames, but allow soft deletion.