N
N
Nikita Guriev2022-03-12 10:53:50
MongoDB
Nikita Guriev, 2022-03-12 10:53:50

How to automatically add unique keys to elements when adding to MongoDB?

Insert JSON like this:

[
  {
    "name": 1,
    "gender": "m"
  },
  {
    "name": 2,
    "gender": "f"
  }
]

So that an ID is added to each object so that you can search by this ID.

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