Subqueries and Updates

Do you plan to support subqueries at some point? I’ve been trying to recreate the below.

select * from accounts where accountid in (select distinct(accountid) from accountholdings where balance > 1000)

I realize this gets very close to being a join, so whatever you plan to support around joining data would be interesting to hear. While 20megs is a lot to play with in terms of our document sizes, we may need to seperate out some of our archived data to avoid hitting this limit and so doing a join would make our lives a lot easier.

Also, will you support updates within JSON documents? For example:

Update account.holderinfo h set h.firstname=‘baz’ where h.lastname = ‘foo’

First on subqueries: yes, we do plan to support these. You are correct that subqueries in the general case are essentially joins. We plan to distinguish in-document subqueries from cross-document subqueries via syntax. This is similar to how we distinguish in-document joins today.

As for document updates, the short answer is yes, but not in the Developer Preview timeframe. We’d be interested in hearing more about your use cases.

Both here! http://blog.couchbase.com/n1ql-dp4-is-here