Use this strategy to get viewentries (column values) from the view. This is the fastest way to get data from the view. Doesn't support categorized views.

Allowed method

Parameters:

 

Let's assume our database has view called (ByTopic).

router.GET('topics') {
   strategy(VIEWENTRIES_PAGED) {
      viewName('(ByTopic)')
   }
   mapJson 'Topic', json:'topic', type:'STRING'
   mapJson '\$124', json:'author', type:'STRING'
}

 

mapJson expects to get programmatic name of the column, json name and type (allowed types are STRING, DATETIME and DOUBLE, for multi-value columns use ARRAY_OF_STRING, ARRAY_OF_DATETIME and ARRAY_OF_DOUBLE).

If programmatic name contains $, you must escape it: \$

You can also use @unid to get universal id of the documents corresponding with the viewentries.

URL parameters:

With route defined above, URL http://server.name/path-to/db.nsf/xsp/.xrest/topics?start=5&count=7 will return 7 viewentries (column values) from view (ByTopic) starting at position 5.

 

Returned JSON:

{
    "entries": [
        {
            "author": "Martin Jinoch",
            "topic": "100005"
        },
        {
            "author": "Martin Jinoch",
            "topic": "100004"
        },
        {
            "author": "Martin Jinoch",
            "topic": "100003"
        },
        {
            "author": "Martin Jinoch",
            "topic": "100002"
        },
        {
            "author": "Martin Jinoch",
            "topic": "100001"
        },
        {
            "author": "Martin Jinoch",
            "topic": "100000"
        },
        {
            "author": "Martin Jinoch",
            "topic": "10000"
        }
    ],
    "start": 5,
    "total": 300,
    "count": 7
}

Related articles

Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.

Related issues