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 8172525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:48:34+00:00 2026-06-06T21:48:34+00:00

I have feeds collection, each feed have comments. So when someone comments on feed,

  • 0

I have “feeds” collection, each feed have comments. So when someone comments on feed, he is added to “subsribers” which is Mongo’s multikey field.

feeds: {
 _id: ...,
 text: "Text",
 comments: [{by: "A", text: "asd"},{by: "B", text: "sdf"}],
 subscribers: ["A","B"]

}

Then when I need to get all feeds with new comments for user A, I ask for feeds with {subscribers: “A”}.

Usually there’re 2-5 comments, but sometimes (on hot feeds) there might be >100 comments and >100 subscribers.

I know that it’s not recommended to have multikey fields with too many keys. So how much is too much?

I ask because I need to decide – if I will use multikeys or is it better to send comments directly to each user. In this case I have to copy feed for each subscriber – and collection will grow VERY fast – which I think isn’t good also: 1000 user, each followed by 10 users, each making 10 actions a day = 1 000 000 records every 10 days!

  • 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-06-06T21:48:36+00:00Added an answer on June 6, 2026 at 9:48 pm

    Although you may experience problems with really large documents, particularly if MongoDB must scan the entire document to fulfill a query, as you would expect; arrays with large numbers of values are not in and of themselves problematic in MongoDB, even if they’re multi-key indexes.

    There is one caveat: the index will not store keys (in the case of a multi-key document, this is the item in the array,) longer than 1024 bytes. As long as the items in the array are shorter than this limit, you should be fine.

    Having said this, you do want to avoid data models where an array or other part of the document will grow unbounded and forever. While MongoDB adds a little bit of padding on disk for every document, if the document grows substantially after creation, the database must move it to another location on disk. However you decide to model your data, ensure that your documents do not tend to grow much after creation.

    Reference:

    • Index Size Limit
    • Multikey Indexes
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a collection which returns a model for each date within a given
I have a website which fetches information from RSS feeds periodically (well, currently manually,
I want to show rss feeds of link http://dekora.com/blog/?feed=rss2 . I have done it
We have a feed process which runs every day of the year. As part
NodeJS + Express, MongoDB + Mongoose I have a JSON feed where each record
Say I have a TabControl that is presenting a collection of Foo objects (each
I have a collection of fairly large page elements which, when clicked, slide out
I have an XML feed (which I don't control) and I am trying to
I have the following code I use to simulate a live data feed which
My app pulls a json data feed , I have just added the reachability

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.