Query certain properties given their "visibility"

Hello, I’d like to Query some properties from my Document if their “read” nested property is “Public”, here I attach the Document JSON structure :

{
	type: "avatar",
	name:{
		read: "Public",	
		write: "Private",
		value: "Tomas Garcia"
	},
	email:{
		read: "Public",	
		write: "Private",
		value: "Email"
	},
	phone:{
		read: "Private",	
		write: "Private",
		value: 123456789
	}
}

In this case the query should return the whole document without the phone property. It should be some SelectResult.expression(…) but I don’t really know how to do it for every property. Any ideas?

Thanks in advance!
P.D: Is an Android App in Java :slight_smile:

In general, when using N1QL, you would need to use CASE expression (Conditional Operators | Couchbase Docs). However, CBL 2.8 doesn’t have the CASE expression supported in its QueryBuilder API. In the next version (3.0), CBL will support querying using the N1QL string which will also support the CASE expression.

Also, unfortunately, there is no workaround for this , you would need to filter that in your application code.