I try to query couchdb server with _find endpoint by attribute, starting with '$' ($ref in my case). But server always returns empty document set.
- I have couchdb documents like this:
 
{
  "_id": "59bb208006149f50bb32f76f4900ccfa",
  "_rev": "1-99022821cc2bb3ab0bdd84ab98b55828",
  "contents": {
    "eClass": "auth#//User",
    "name": "SuperAdminUser",
    "roles": [
      {
        "eClass": "auth#//Role",
        "$ref": "59bb208006149f50bb32f76f4900c962?rev=1-24d9469afe50f162e473b09fdbd95154#/"
      }
    ],
    "email": "admin@mydomain.ru",
  }
}
- I try to query this document like this:
 
{
    "contents": {
        "eClass": "auth#//User",
        "roles": {
            "$elemMatch": {
                "eClass": {"$regex": ".*auth#//Role"},
                "$ref": {"$regex": "^59bb208006149f50bb32f76f4900c962.*"}
            }
        }
    }   
}
but no results returned.
- Query like
 
{
    "contents": {
        "eClass": "auth#//User",
        "roles": {
            "$elemMatch": {
                "eClass": {"$regex": ".*auth#//Role"}
            }
        }
    }   
}
works as expected.
It seems the mango server did not recognize attributes like $ref.
I tried to escape attribute with "\$ref" with no success. (not true!!!, see update)
Is there any workarounds to query such attributes like $ref?