L
L
levnikrot2021-07-07 18:04:13
MongoDB
levnikrot, 2021-07-07 18:04:13

How to get value from MongoDB nested array?

result.images = await Titles.findOne({
                enName: req.params.titleName,
                content: {
                    $elemMatch: {
                        tome: +req.query.tome,
                        chapters: {
                            $elemMatch: {
                                chapter: +req.query.chapter
                            }
                        }

                    }
                }
            }).lean();


How can I get just the chapter value?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rag'n' Code Man, 2021-07-08
@iDmitriyWinX

result.images.content.chapters.chapter

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question