These are chat archives for Automattic/mongoose

12th
Oct 2017
Vlado Tesanovic
@vladotesanovic
Oct 12 2017 06:41
@jemliF I don't think so, did you hit the limit?
Vlado Tesanovic
@vladotesanovic
Oct 12 2017 06:48

@seltsam23

You can store it as one document?

{
  order_reference: 1,
  order_date: '....',
  items: [{
          order_in_list: 1,
          qty: 3,
          item: {}
  }]
}
amanshharma
@amanshharma
Oct 12 2017 11:02
Hey
How can we check if username already exist and after that check its id ..then do the operation like update or delete or nothing
Jemli Fathi
@jemliF
Oct 12 2017 11:24
@vladotesanovic No but, It ignores the enum validation completely, I thought maybe there is a limit... I am passing an array containing a list of all countries in the world if it make a sense
Arye Shalev
@pantchox
Oct 12 2017 21:18

Hi guys, i have this scenrio i need advice on.
I have 3 schemas A,B,C.
B has reference to A, so A has relationship of one to many to B
C has reference to B, so B has relationship of one to many to C

I want when i delete A, all B's and C's will be deleted.
So what i do is i find if A exists then query B.remove({refA: _a_id_to_delete}); then i need to find ALL removed B documents and grab all their IDS and do the same to the relationship of B and C. what is the best way to do that? when i do remove i get query object, how do i know from query object what are the ids i deleted?