How to query documents which are arrays

Hello all,

I’m a novice Couchbase user and I have a bucket which I’ve created that contains documents which are actually arrays in the form of:

	"key": [
			"data1": "somedata1"
			"data2": "somedata2"

I want to query these documents via N1QL statements and have yet to find a solution to how to do this properly. More specifically, I would like to select fields inside each sub-document that is in an array of a certain key. For example, I would like to access: key.[1].data2 or key.[0].data1

How should I do it?
Thanks in advance, Oren.

If you want access them key[0].data1 or key[1].data2

If you want use in WHERE clause
ANY v FOR v IN key SATISIFIES v.data1 = “xyz” END

Checkout article by @johan_larson

Checkout more details for array indexing