I have the result of a long lasting operation, a MongoDB query:
const a = collection.find({}).project({ name: 1 }).toArray()
It has the type of Promise<Document[]>
I would do a transformation, but it is not possible:
let a2 = a.map((i) => {i._id, { name: i.name }})
In Vapor / Swift, there is a map
not only for array, but also for promises, what about in JS / TS?
How can I apply further operation on the Promise<Document[]>
?