N
N
NarkoMan012021-01-27 19:43:07
MongoDB
NarkoMan01, 2021-01-27 19:43:07

Different result with the same MongoShell and Node.js query?

Hello!
I just can’t understand, I wanted to get the “B183” object, make a request through NODE.js, as a result I get the entire document, I try through mongoShell getting the desired part of the document

Request:

db.subjects.find(
  {"ФизМат.Педагогические науки.B183": {$exists: true}}, 
  {
    _id: 1, 
    "ФизМат.Педагогические науки.B183": 1 
  }
)


"Database"
"ГеоБио": {
  "Педагогические науки": {
    "B001": {
      "code": "B001",
      "name": "Педагогика и психология",
      "max": " 140",
      "min": " 97",
      "minWithQuota": " 91"
    }
  }
},
"ФизМат": {
  "Педагогические науки": {
    "B183": {
      "code": "B183",
      "name": "Агроинженерия",
      "max": "140",
      "min": " 50",
      "minWithQuota": "none",
      "quotes": []
    }
  }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Israfil22, 2021-01-27
@NarkoMan01

collection . find
The second argument is options . projection
Shell and drivers are different things

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question