N
N
NarkoMan012021-01-25 21:12:35
MongoDB
NarkoMan01, 2021-01-25 21:12:35

Why is the findOne query returning the entire mongodb collection?

Hello!
How to get the object "B183", for some reason findOne returns the entire collection

My query: db.findOne({'PhysMath.Pedagogical sciences.B183.code': "B183"})

"ГеоБио": {
  "Педагогические науки": {
    "B001": {
      "code": "B001",
      "name": "Педагогика и психология",
      "max": " 140",
      "min": " 97",
      "minWithQuota": " 91"
    }
  }
},
"ФизМат": {
  "Педагогические науки": {
    "B009": {
      "code": "B009",
      "name": "Подготовка учителей математики",
      "max": "140",
      "min": " 107",
      "minWithQuota": " 95"
    },
    "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)
D
Daniil Vasilyev, 2021-01-26
@NarkoMan01

This is one document from the collection, you set a condition, it found it and issued it. And you probably want to get part of the document.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question