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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:00:40+00:00 2026-05-31T14:00:40+00:00

Suppose I create a document in a MongoDB collection with the following structure and

  • 0

Suppose I create a document in a MongoDB collection with the following structure and command:

db.foo.insert(
    {
        "PatientCore" :
        { "Name" : "John Doe", "Age" : 30 },
        "OnArrivalData" :
        {
            "Readings" :
            { "Temperature" : 100.1, "HBP" : 140, "LBP" : 88, "TimeStamp" : new Date() },
            "Attending Doctor" : "Dr. Samuel John"
        },
        "TreatmentStage" :
        [
            {
                "StageName" : "Surgery",
                "Readings" :
                [
                    { "Temperature" : 100.1, "HBP" : 130, "LBP" : 70, "TimeStamp" : new Date() },
                    { "Temperature" : 99.1, "HBP" : 120, "LBP" : 70, "TimeStamp" : new Date() 
                ],
            },
            {
                "StageName" : "ICU",
                "Readings" :
                [
                    { "Temperature" : 99, "HBP" : 135, "LBP" : 72, "TimeStamp" : new Date() },
                    { "Temperature" : 98.6, "HBP" : 141, "LBP" : 80, "TimeStamp" : new Date() }
                ],
            }
        ]
    }
)

Firstly, please note that I have multiple occurrences of “Readings” in the document.

I want to query “Readings” across the document in such a way that I don’t have to qualify it with the reference to the embedded document. How can I achieve this? We can assume that the structure of “Readings” will be consistent.

I know that I can also work towards re-structuring the document, but here I don’t have the liberty to do so.

  • 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-31T14:00:41+00:00Added an answer on May 31, 2026 at 2:00 pm

    That is currently not possible as it would require MongoDB to understand field name wildcards. It would have to allow things like {'*.Readings.Temperature': 99} which it does not at time of writing.

    Ther feature request is here https://jira.mongodb.org/browse/SERVER-267

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

Sidebar

Related Questions

Suppose I create collection like Collection<IMyType> coll; Then I have many implelentations of IMyTypem
Suppose I have the following: using(var ctx = DataContextFactory.Create(0)) { ... Some code ...
I want to create an object which represents an html document which is suppose
Suppose you create a generic Object variable and assign it to a specific instance.
Suppose I create a very simple socket connection, how can one programatically: Find out
This is about inheritance in JavaScript. Suppose I create a constructor Bird(), and another
Suppose I want to create a set of observers based on type. That is
Suppose I have a table like: create table { id numeric(5,3), code varchar(10) }
Suppose I have a user defined type: CREATE OR REPLACE TYPE TEST_TYPE AS OBJECT
Suppose I have a stored procedure that manages its own transaction CREATE PROCEDURE theProc

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.