Array with documents from collection
robert-joosen opened this issue · comments
let collection = db["users"]
var projection: Projection = ["username","password"]
projection.suppressIdentifier()
var users: [Document] = Array(try collection.find("username" != nil, projecting: projection).flatMap{ document in
return Document(array: document.arrayRepresentation)
})
let data: Document = [
"data": Document(array: users)
]
return data.makeExtendedJSONString()