I am querying a collection and I want to update the results.
I want to update a field and let the remaining fields untouched.
I have entries with "filename" and "projectId" as keys
In this case I am doing:
val olderFiles = conn.find(query ++ ("filename" -> filename) ++ ("projectId" -> file.projectId))
val updatedFiles = olderFiles.map{cursor =>
cursor.put("newField",field)
cursor
}
updatedFiles.foreach(conn += _)
However this is slow. How do I update a list of objects in a more efficient manner?
Thank you!