How can I embed documents in documents?

Hi,
I have question about data modeling and the API of Couchbase Lite 2.0.

I am not sure how I can achieve embedding documents as described here (Embedding “1” in “many” side) with the current available API.

I expected some API like this:

let studentDocument = ...
let students = classDocument.array(forKey: "students")
students.appendDocument(studentDocument)

The only way I could find was referencing documents but not embed them.
Is there a way to embed documents with the current API otherwise it would be nice to have an API method for that?

Thanks

Version: 2.0
Client OS: iOS 11.2
Server: n/a

You cannot embed Document type documents into another Document but you can embed a JSON dictionary/map corresponding to the Documents that you want to nest.
So in your case, you would do something like this

// students is an array of JSON objects
classDocument.setArray(students, forKey: "students")