These are chat archives for Automattic/mongoose

18th
Dec 2015
Dipankar Arhat
@dbelieves
Dec 18 2015 06:27
hi all, any examples of how do i model my mongoose db... links will be appreciated...
James Lee
@uptownhr
Dec 18 2015 07:06
@dbelieves what do you mean by model?
Dipankar Arhat
@dbelieves
Dec 18 2015 07:08
@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
@uptownhr
Dec 18 2015 07:09
@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
@dantaex
Dec 18 2015 09:56
Anyone here has ever used Model.update ?
Earl Lewis
@elewis33
Dec 18 2015 12:41
@dbelieves have you tried this?
Tim Elfelt
@timelf123
Dec 18 2015 20:03
Hi all. how do I populate a subdocument? Here is an example of my schema
dontwork
@dontwork
Dec 18 2015 21:45
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?