Page tree
Skip to end of metadata
Go to start of metadata

Use this strategy to get documents from the database by specified formula.

Allowed method

  • GET


  • databaseName(String databaseName): name of the database to read data from, use "server!!path/database.nsf" format; when omitted, current database is used
  • selectQuery(String query): selection formula to apply to the database; mandatory. This is exactly the same you would write as view selection formula in Notes.


router.GET('topics/cat1cat2') {
   selectQuery('SELECT Form=\"MainTopic\" & @Contains(Categories;\"category1\":\"category2\")')
 mapJson 'id', json:'id', type:'STRING', isformula:true, formula:'@DocumentUniqueID'
 mapJson 'date_created', json:'date_created', type:'DATETIME', isformula:true, formula:'@Created'
 mapJson 'topic', json:'topic', type:'STRING'
 mapJson 'author', json:'author', type:'STRING', isformula:true, formula:'@Name([CN]; @Author)'
 mapJson 'categories', json:'categories', type:'ARRAY_OF_STRING'


URL parameters:

  • count: number or records to return, default is 10
  • start: position in the view to start from, default value is 1


With route defined above, URL will return all documents from database, that match the selection formula.

Returned JSON:

  "entries": [
      "author":"Martin Jinoch",
      "categories": [
      "author":"Martin Jinoch",
      "categories": [