'How to insert array to object using postman and nodejs. Send the data to mongodb

I Write My code like this but it has error, How to rewrite this code

db.collection('collection_name').insertOne({
name:req.body.name,
details:[{
age:req.body.age
}]
})
})


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source