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

168
Views
Mongoose find all posts and get the hottest categories

i have this problem where i need to find the hottest categories from all the posts that i've search.

This is my POST schema model

var PostSchema = new mongoose.Schema({
    maincategory: String,
    subcategory: String,
    quantity: String,
    budget: Number,
    name: String,
    description: String,
});


PostSchema.index({name: 'text', description: 'text'});

So what i need to do is, crawl to all the posts, check their main category and sub category, then after crawling to all posts and get their categories, i need to count on how many posts on this categories then sort out the categories where i will show the categories which has the highest amount of posts. Then i will show which categories are the hottest, maybe top 5

Thank you!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

After searching Stackoverflow for answer, i finally found it! It's called aggregate. (Sorry didn't know the word)

https://stackoverflow.com/a/26623244/6802296 Thanks to this link i was able to solve my problem

over 4 years ago · Santiago Trujillo Report
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!