문제

I have initiated an empty BSONArray an the used the add function to add some BSONDocuments but BSONArray stays empty

Here is some sample code

  var parameters = BSONArray()
  parameters add BSONDocument("$limit" -> limit)

The limit document is just not added...

도움이 되었습니까?

해결책

I suspect BSONArray is immutable and the add operation is returning a new array. Try:

var parameters = BSONArray()
parameters = parameters add BSONDocument("$limit" -> limit)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top