Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I have two mongodb collections . Student, Parent

Students have a reference parentId.

I am trying to fetch specific student as

Student.(query, update, {'fields': parentFieldsRequired , 'new': true},function(err,mData)
    {

    });

I also want to attach the parent object with specific fields to student object.

The end result would be something liek

username: abc,
    fullName: abc,
    password: abc,
    image: abc,
    backgroundImage: abc,
    parent:{
        fullName: abc,
        image: abc
    },

How can i update the findOneAndUpdate query to have achieve above response.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.