Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

136
Views
How to get mongoose model have an array field that other Mongoose document's can be referenced in?

I am working on a web app to create, organize and quickly use your code snippets, with plans of VS Code integration to sync snippets to your snippets json files.

I have two mongoose models, one called "groups" and one called "snippets". A user can create a snippet just fine, but now I want to make the groups model act as a way to group multiple snippets together. So one of the fields in the collections model is an array that defaults to an empty array.

So now to get to the point. I need that snippets array contain actual references to a document in the snippets collection. This way it can be dynamic and let me do things such as going to delete the snippet only, and now a groups document automatically removes the reference from the array.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!