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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:39:08+00:00 2026-06-16T04:39:08+00:00

I’m currently learning Node.JS and need to implement a database. All of the Node

  • 0

I’m currently learning Node.JS and need to implement a database. All of the Node books seem to think MongoDB is the best solution but I can’t seem to get my head around NoSql databases like Mongo and Couch, I’m an MS SQL Server guy!

So, I understand that you can keep structured data as records (JSON) but I’m not sure how you’d model a typical ecommerce app with the following (simplified) tables…

customers (id, name, address)
orders (id, customerID, orderDate)
orderItems (id, orderID, productID)
products (id, title, description, image)

So, normally I’d write a query like this (but better optimized obviously)….

SELECT Customers.name, Products.title 
FROM (orders INNER JOIN customers ON orders.customerID = customers.id)
INNER JOIN orderItems ON orderItems.orderID = orders.id 
INNER JOIN products ON orderItems.productID = products.id 

If I could see an example of how this would work in a NoSQL database then I might start to “get it”.

Alternatively, am I just better off sticking with MSSQL Server or MySql, both of which are compatible with Node anyway?

  • 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-16T04:39:09+00:00Added an answer on June 16, 2026 at 4:39 am

    An important consideration when designing a schema for MongoDB is not what your data is, but how you will be using it. Without working out what type of reads and writes you will be doing (and how performant they will be) it can be difficult to design an “optimal” schema.

    There are some basic guidelines that you can consider to avoid running into problems. One of them is avoid designing documents which keep growing unbounded. That means you should not embed orders into customer documents. Another rule is that things that aren’t “of interest” on their own (or don’t exist on their own) are probably better off being embedded. This suggests that orderItems do not deserve their own collection and should simply be treated as attributes of orders (which is what they are, in fact).

    This exact exercise is covered in MongoDB developer training, being a pretty typical example of schema design.

    Bottom line is that you should have three collections:

    Products
    Customers
    Orders

    Orders will reference customers (optionally denormalizing some information from customer collection) and they will reference products (in the array of orderItems they will contain).

    Further collections, and exact fields in all these collections depend on your specific use case, but I can’t see a feasible scenario to have fewer collections than these three.

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

Sidebar

Related Questions

Let's say I'm outputting a post title and in our database, it's Hello Y’all
I need to clean up various Word 'smart' characters in user input, including but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms

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.