0

I'm new to MongoDB and I'm trying to query the following collection (named sample):

{
    "_id": "thresholds",
    "thresholds": [{
        "GRADE": "CC004",
        "C": "",
        "CF": "",
        "MN": "0.01",
        "N": "",
        "P": "0.03",
        "SI": "",
        "CR": ""
    }, {
        "GRADE": "CC005",
        "C": "",
        "CF": "",
        "MN": "",
        "N": "",
        "P": "",
        "SI": "",
        "CR": ""
    }]
}

I'm trying to retrieve the entire record where the "GRADE" is "CC004".

Right now, I'm doing the following: db.sample.find({"thresholds": {"GRADE": "CC004"}}). However, it's returning null value because nothing was found. How can I rephrase my query to find my entry of interest?

kryogenic1
  • 166
  • 1
  • 2
  • 15

1 Answers1

0

You could make the following query:

db.sample.find({"thresholds.GRADE": "CC004"})