Pergunta

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...

Foi útil?

Solução

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

var parameters = BSONArray()
parameters = parameters add BSONDocument("$limit" -> limit)
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top