Friday 27 April 2018

updating embedded documents - mongodb

i have a user model which is below{ joined: 2018-04-26T21:32:20.386Z, _id: 5ae245643da2df2c8fb8943b, username: 'Sean1', password: '$2a$10$4IFcq/.NXxL2PQsvxYSS6uZmB18jG6DgW29dwPSE01K93eKFLeGFa', __v: 0, posts: [ { i: '5ae245783da2df2c8fb8943c', title: 'Sean', chapters: [] }, { i: '5ae2458c3da2df2c8fb8943d', title: 'Paul', chapters: [] } ] } each user makes a post an a user has a option to add chapters onto that post. how can i for example update the post about paul without affecting sean and push an object into puals chapter array?

Submitted April 27, 2018 at 05:01PM by SeanCarroll17

No comments:

Post a Comment