GithubHelp home page GithubHelp logo

Comments (5)

sgundlapalli11 avatar sgundlapalli11 commented on August 9, 2024 2

I would like to take this on if possible.

Just to understand where the issue is, is this where we are looping through the parent comments?

from software-engineering-daily-api.

sgundlapalli11 avatar sgundlapalli11 commented on August 9, 2024 2

Still working on this, just haven't been able to dedicate much time to it. Just wanted to post here to keep it updated.

from software-engineering-daily-api.

jasonify avatar jasonify commented on August 9, 2024

Perfect and yeah exactly that :) . The last two functions on the Controller.model : https://github.com/SoftwareEngineeringDaily/software-engineering-daily-api/blob/5664f36eb976aabb76c58d03a4375b92fd5c680a/server/models/comment.model.js

Note the lean() call, since we modify those objects when populating the votes on each comment.

Most of this logic could also be moved from the controller to the model (like in the Post model).

from software-engineering-daily-api.

sgundlapalli11 avatar sgundlapalli11 commented on August 9, 2024

To approach this problem, I was going to add a method to take in all the parentComments and return childrenComments. I would make the query similar to this to return multiple documents?

Something I see we may have to do, is when we have all the childrenComments, we would then have to loop through them each one to add them to the appropriate parentComment which is happening here. I'm assuming that would still be preferred over sending a query for each parentComment though.

from software-engineering-daily-api.

jasonify avatar jasonify commented on August 9, 2024

👍 That's right, we just want to avoid the multiple queries

from software-engineering-daily-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.