Для этого нужно попробовать агрегирование :
db.collection.aggregate([
/** match docs based on criteria same as find */
{ $match: { "category": "concept art" } },
/** group all docs and push imageUrls to an array */
{ $group: { _id: '', imgUrl: { $push: '$imgUrl' } } },
/** remove _id from final doc */
{ $project: { _id: 0 } }])
Сбор данных:
/* 1 */
{
"_id" : ObjectId("5e2bc27cdc95d08ab83819e8"),
"category" : "concept art",
"isImage" : true,
"imgUrl" : "images\\2020-01-23T14-41-48.158Z-abandoned.jpg"
}
/* 2 */
{
"_id" : ObjectId("5e2bc27cdc95d08ab83819e9"),
"category" : "concept art",
"isImage" : true,
"imgUrl" : "images\\2020-01-25T01-45-14.880Z-pIMG_6443.jpg"
}
Вывод:
/* 1 */
{
"imgUrl" : [
"images\\2020-01-23T14-41-48.158Z-abandoned.jpg",
"images\\2020-01-25T01-45-14.880Z-pIMG_6443.jpg"
]
}