S
S
Stanislav2019-07-31 14:54:08
MongoDB
Stanislav, 2019-07-31 14:54:08

How to find a document in mongodb with an exact match on a part of an array?

How to more correctly find documents with an exact match in part of the array
For example, there is a field in the database

field: [
 "a",
 "b",
 "c",
 "d",
 "e"
]

And there is an array
[
 "a",
 "b",
 "c"
]

You need to find documents in which field[0] = a, field[1] = b, field[2] = c
And nothing else.
I just do not want to fence like this in the request (field[0] = a, field[1] = b, field[2] = c)
Maybe there is a more correct option?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question