These are chat archives for Automattic/mongoose

3rd
Nov 2015
Cameron Roe
@cameronroe
Nov 03 2015 05:00
Anyone know any good resources for learning patterns in Mongoose?
Tutorials/Training would be epic.
dpinart
@dpinart
Nov 03 2015 13:43
Hi. where can I find an up to date typescript definition file (mongoose.d.ts)?
Valeri Karpov
@vkarpov15
Nov 03 2015 15:16
@cameronjroe don't know of any beyond the docs. Although, shameless plug, my upcoming video course on EdX has a fair bit about mongoose and schema design and it's free: https://www.edx.org/course/introduction-mongodb-using-mean-stack-mongodbx-m101x
@dpinart we don't have one, we're not really big on typescript yet :) you're more than welcome to contribute one though
Sathya Narrayanan
@sourcepirate
Nov 03 2015 17:45
hey guys how do i safely remove an objectid from DBRef array and when i actually remove the reference object itself. for example i have people and phone-number models people model has a DBRef array of phone-number objects. if i delete a phone-number object in phone-number model, how can i remove all references associated with it safely??
Valeri Karpov
@vkarpov15
Nov 03 2015 20:01
@plasmashadow the way to do this would be with the usual mongodb transaction pattern of "have a separate collection for multi-doc deletes" if you're really concerned about durability: https://docs.mongodb.org/manual/tutorial/perform-two-phase-commits/ . In most cases its just sufficient to first remove the ObjectId then remove the child doc - this is fine as long as you don't really care about orphaned child docs
@uptownhr $where is probably the best way to do this. Or you could just load the docs one-by-one into a node process and transform them there.
James Lee
@uptownhr
Nov 03 2015 23:27
@vkarpov15 wish plugins.mongoosejs.com is browseable
@vkarpov15 is this site on github by any chance? Would love to contribute