N1QL + where in collection

Hi there.

I’m very new in N1QL, please assist.

Let’s suppose I have documents like this:

key1=321

{
“propertyName1”: {
“value”: “value1”,
“last_update”: “2014-07-29T14:45:09Z”,
“version”: 59
},
“propertyName2”: {
“value”: “value2”,
“last_update”: “2014-09-30T09:50:59Z”,
“version”: 3
},
“propertyName3”: {
“value”: “value3”,
“last_update”: “2011-01-10T12:13:15Z”,
“version”: 397
}
}

key1=322

{
“propertyName1”: {
“value”: “value33”,
“last_update”: “2013-11-18T09:45:09Z”,
“version”: 123
},
“propertyName3”: {
“value”: “value99”,
“last_update”: “1981-04-29T10:10:59Z”,
“version”: 12344
}
}

Is it possible to get documents having ANY.last_update older then some specific value?

I know it is possible to reorganize document structure - I can put property name to collection like this:

{
“name” : “propertyName1”,
“value”: “value1”,
“last_update”: “2014-07-29T14:45:09Z”,
“version”: 59
}

and use UNNEST clause.

But I want to have propery name as a part of json, because it is unique across the document.

Thanks :slight_smile:

Hi,

The feature you are requesting will be available in our next developer preview release, DP4. In the current DP3 release, you would need to restructure your data as you described.

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