E
E
Erik Mikoyan2020-09-20 10:51:54
Mongoose
Erik Mikoyan, 2020-09-20 10:51:54

How to update the value of an array element in mongoose by its field?

I have a document with a field itemswhich is an array. This array stores objects with the same schema and field title.

{
  id: "Id",
  title: "Заголовок",
  items: [
    {
      subtitle: "Подзаголовок1",
      text: "",
      // ...
    },
    {
      subtitle: "Подзаголовок2",
      text: "",
      // ...
    },
    {
      subtitle: "Подзаголовок3",
      text: "",
      // ...
    },
  ],
  // ...
}

How can I edit the field textof a specific array element?

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