SparkMongoCollectionReadWrite.find() does not return an array - it returns a SparkMongoCursor. Instead try progressCollection.find({"tribe.name": ""}).toArray()
You shouldn't use toArray() for performance reasons.
Loop over the result like this:
var progressCollection = Spark.runtimeCollection("Tribes"); var cursor = progressCollection.find({"tribe.name": ""}); var doc; while(cursor.hasNext()) { doc = cursor.next(); doc.acti++; }
Vivian Manders
Need to iterate through every single log in a runtime collection and add 1 to the variable "acti"
Getting errors on the "foreach" line. I'm not sure any of it is correct.