How to update Collection with more Object?


#1

I have 2 Collection A and B:

A : {_id, aField}
B : {_id, bField}

When I insert the B, A will update with add new _bField object field contain of B doc

A: {
   _id:...,
   aField:...,
   _bField: {
      bId: {_id:...., bField:........}
   }
}

And then if I insert new more on B, A update with the new too.
Please help me.


#2

what is the problem of doing it manually? :smile:
what is the need of doing so?


#3

I would like to cache doc back, when I insert the new doc on B, and then update A with the new field object (It will update more via B).