wohali opened a new issue #1554: Additional Mango-based update handler / VDU 
functionality
URL: https://github.com/apache/couchdb/issues/1554
 
 
   This ticket is intended to gather ideas for what other sorts of update 
handler / VDU functionality we could add to Mango to provide a declarative 
replacement for JS-based update handlers and VDUs. This is intended as a 
"blue-sky" ticket to gather ideas that can be implemented simply in a 
declarative fashion.
   
   From #1534, I wrote:
   
   > There are other proposals to provide similar/useful functionality (#1532, 
#1533, #1498) if the operator decides to run without a JS engine (#1513), plus 
I suspect there are thoughts about doing Mango-based update functionality to 
filter fields, as well as apply database schema enforcement (type and format 
checking) in a declarative fashion for a NoJS mode. Could your embedded RasPi 
update function be written declaratively? I assume you're adding info such as 
incoming IP address, central timestamp, etc. which I could see being done 
automatically quite easily. This is a use case we can accelerate without the 
use of JS readily; we just need to agree on an API and how to write it down in 
a JSON blob.
   
   Extracting:
   
   * Add datetime stamp (#1533)
   * Add IP address from incoming host, or other fields from the `req` object
   * Add additional content based on fields in the `req` object
       * Perhaps a lookup table that maps a `req` field value to a key:value 
pair (or JSON Patch) to insert?
   * Filter out (blacklist) or only allow (whitelist) certain fields (lists) - 
this is partial JSON schema support
   * Type-checking (field `type` is string, field `date` is ISO datetime|UNIX 
epoch, _etc._)
   * Field validation (format-checking, i.e. string must match a regex like 
`"$###.##"` or an integer must be within a certain range)
   * Consider using output of another Mango index/query for validating a field? 
For instance, a Mango query of documents that are of type `source` and 
extracting the field `ip_address`, then only allowing documents to come through 
that have a matching `req.ip_address` (for example).
       * Same as above, but to implement the lookup table. Example: look up 
source's IP address, auto-add name of sensor which is in the first document 
that matches in the Mango index

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to