Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-58534

XDCR filter expression - support ability to match elements in an array when array-position is not known

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • None
    • 7.6.0, 7.0.0, 7.1.0, 7.2.0
    • XDCR
    • None
    • 0

    Description

      Multiple customers are asking that XDCR filter expressions support the ability to match elements in an array when the array position is not known:

      Example 1:

      You have documents that look like this:

      {"field1": "aaa","field2": "bbb","countries": ["India","USA","Canada","Mexico"]} 
      {"field1": "aaa","field2": "bbb","countries": ["USA", "Canada", "Mexico", "India"]} 
      {"field1": "aaa","field2": "bbb","countries": ["USA", "Canada", "Mexico"]}
      

      You want to replicate all documents that have "India" in countries using an XDCR filter expression like below (currently not supported):

      REGEXP_CONTAINS(countries[*], "India")
      

      instead of having to use:

      REGEXP_CONTAINS(countries[0], "India") OR REGEXP_CONTAINS(countries[1], "India") OR REGEXP_CONTAINS(countries[2], "India") OR REGEXP_CONTAINS(countries[3], "India")
      

       

      Example 2:
      You have documents that look like below:

      {"Id": 1011,"Address": [{"Street": "Elm","City": "Topeka"}, {"Street": "Main","City": "Los Angeles"}]}
       
      {"Id": 1021,"Address": [{"Street": "Crescent","City": "London"}, {"Street": "Sunset","City": "Los Angeles"}]}
       
      {"Id": 1031,"Address": [{"Street": "Maple","City": "Calgary"}]}
      

      You do not want to replicate any document that has an address in Los Angeles using an XDCR filter expression like below (currently not supported):

      Address[*].City != "Los Angeles"
      

      Instead of having to use:

      Address[0].City != "Los Angeles" AND Address[1].City != "Los Angeles"
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            neil.huang Neil Huang
            hyun-ju.vega Hyun-Ju Vega
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty