These are chat archives for Automattic/mongoose

Dec 2015
Dipankar Arhat
Dec 18 2015 06:27 UTC
hi all, any examples of how do i model my mongoose db... links will be appreciated...
James Lee
Dec 18 2015 07:06 UTC
@dbelieves what do you mean by model?
Dipankar Arhat
Dec 18 2015 07:08 UTC
@uptownhr , i want to design the database. i want to see examples of schema so that i can get a fair idea about starting on with mongoose.
James Lee
Dec 18 2015 07:09 UTC
@vkarpov15 going back to "@uptownhr unique index on sub-doc array makes that value globally unique. If you want it to be unique within an array, you can either use addToSet or just check before saving your document and make sure to not use .push()"
the mongoose site has pretty good examples
@vkarpov15 i actually did try using "addToSet" but I don't think that works with schemas ...
i mean sub-docs
someone mentioned it had to be identical, and maybe the _id creation makes it so it's not unique
is addToset supposed to work with subdocs?
Israel Cruz
Dec 18 2015 09:56 UTC
Anyone here has ever used Model.update ?
Earl Lewis
Dec 18 2015 12:41 UTC
@dbelieves have you tried this?
Tim Elfelt
Dec 18 2015 20:03 UTC
Hi all. how do I populate a subdocument? Here is an example of my schema
Dec 18 2015 21:45 UTC
how would you model opening times which are the same for 1/2 of the year and different for the other half, and closed over christmas?