Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5951225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:30:23+00:00 2026-05-22T17:30:23+00:00

Being new to MongoDB I’m not really sure what would be the best practice

  • 0

Being new to MongoDB I’m not really sure what would be the best practice for this.

Currently Posts have a set of tags assigned to them, and I’d like to include at the bottom of each post a “Related Posts” section. What would be the different/best way(s) to accomplish this in MongoDB?

My initial guess is that I would scan for which posts have ANY of the parent post’s tags, then I’d cycle through the posts and count how many of the parent post’s tags they have. The ones that have the highest amount of same tags would be first. Though this seems incredibly ineffecient.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:30:24+00:00Added an answer on May 22, 2026 at 5:30 pm

    Thanks guys, I ended up storing the related documents inside the parent document.

    To find related documents, I found all which have ANY of the parent document tags, then sort by how many tags they mutually have.

    Here is the logic:
    https://github.com/bevry/docpad/blob/2bcfd152b4b55bab8944c968b8bf093300925319/lib/docpad.coffee#L297

    Here is the schema:
    https://github.com/bevry/docpad/blob/2bcfd152b4b55bab8944c968b8bf093300925319/lib/docpad.coffee#L85

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I figured this would be simple, but being new to SSRS I'm not sure.
Being new to this I really am trying to learn how to keep code
Being new to Scala (2.9.1), I have a List[Event] and would like to copy
I have done this many times in PHP using JS but being new to
This is weird, and probably due to me being new to ruby. I have
being new to WPF this is a complex problem for me. What i want
Being resonably new to using GTK+, im not fully aware of all its functionality.
Being new to JQuery and trying to understand all the posts about different ways
being new to c# I've run into this 'conundrum' when passing around a SqlDataReader
I am relatively new to MongoDB, and so far am really impressed. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.