Get data from array with several object

i would like to get the "-lists" data from an array with several objects:

[{...},{...},{...},{"-name": "Test", "-lists": [123, 456, 789]},{...}]

i tried with a filter function but it doesnt works :-(

this is the query where i would like to change the result to the value/array of "-lists"

             .findOne({ _id: serviceID }, function (err, result) {
                if (err) {
                    res.json(err);
                } else {
                    try{
                        res.json(result.service.modules)
                        console.log(result.service.modules)
                    }catch(error){
                        console.log(error)
                    }
                        
                }
            })

Have someone an idea for me?

Best regrads & stay healthy



Read more here: https://stackoverflow.com/questions/67000468/get-data-from-array-with-several-object

Content Attribution

This content was originally published by Beer-Hunter at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: