Hello. Relatively new to the CBL and the forums. We have a very simple Swift issue when trying to print the results of a query.
In this example, the person collection has three documents, so the expected output to console is three “test” strings.
let collection = try! db.collection(name: "person")
let query = QueryBuilder.select(SelectResult.all()).from(DataSource.collection(collection!))
let results = try! query.execute()
//print(results.allResults().count) //causes the following code to not work
for row in results { //will not run if print statement is called
print(“test”)
}
Note that the //print line is commented. If that line is uncommented, there is no output.
It seems that this results.allResults()
is mutating results to where they are all removed.
We investigated the API and there’s no mention of that call .allResults()
blowing out the data. It appears it should just return an Array os Result objects. Is removing the results expected behavior?
3 posts - 3 participants