Select all with Meta.id with flat result


#1

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!


#2

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