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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:03:49+00:00 2026-06-06T07:03:49+00:00

I am storing a string in a database along with the owners of the

  • 0

I am storing a string in a database along with the owners of the string (one or more owners per string).

I’ve always worked with MySQL which is a conventional relational database. In that case, I would store the string along with a unique id in one table, and then the unique id of the string along with the owners (as multiple records) in a second table.

I could then fetch strings by owners using a SQL Join.

I am now working on a project using MongoDB, and I’m doing the same as above.

Would this be considered the wrong way when working with NoSQL databases? Should I not be thinking in terms of ‘relations’ when working with NoSQL?

Another way I can think of achieving the same in MongoDB is storing it like this:

{
    "string": "foobar",
    "owners": [
        "owner1",
        "owner2",
        "owner3"
    ]
}

However, in this case, I’m unsure how I would search for “all strings owned by owner1”.

  • 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-06T07:03:50+00:00Added an answer on June 6, 2026 at 7:03 am

    This looks like the correct approach; remember though, it always depends on the totality of your project, what the goals are (performance, flexibility), what queries you intend to run most heavily, if you need to run ad-hoc queries, and other factors. In general though, using nested documents, as you wrote, is the correct alternative to using joins and foreign keys.

    Keep in mind also the maximum document size (currently 16MB), which would be a concern if there are many (like, hundreds of thousands) of owners of a given string.

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

Sidebar

Related Questions

I am storing a bunch of user ID's inside of a mySQL database along
I am loading a string from my database which among other things contains line
I am storing and editing some field in a database that involves a long
i am storing url string in database like this, 'http://www.domain.com' how can i display
I have a database storing VIN numbers (stored as VID) for vehicles which are
I'm pulling serialized data from a database along with an object type (where one
I am storing data in Sqlite Database along with the date of insertion. The
i have a mysql database storing uploaded photos , i am trying to generate
I have a MySQL statement that inserts some variables into the database. I recently
I have a database and I'm storing images in it along with a person's

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.