Select all with Meta.id with flat result

If I do QueryBuilder.select(SelectResult.all(), SelectResult.expression(Meta.id)), the results look like this:

{ "id": "1", "db": { "foo": "bar" } }

How can I return flattened results like this?

{ "id": "1", "foo": "bar" }

I found the same question here, but I’m not sure how to translate the answer to the CBL 2.0 QueryBuilder. Thanks!

The query engine cannot output in such a way. You will need to run some processing on the resulting structure to flatten it as you desire. Not all of the functionality from N1QL is in mobile (though we are evaluating which to include / prioritize).