Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

169
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda