-
Notifications
You must be signed in to change notification settings - Fork 192
DATACOUCH-407 - Use meta prefix for metadata properties in N1ql predi… #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…cates Change part tree based N1ql query construction for metadata properties to add meta prefix. The metadata information stored as properties are version and id. The meta prefix is currently empty without the bucket name, referring the bucket could be an enhancement in future, but it should not break things as there is only one bucket involved in a repository part tree query.
@@ -75,6 +77,10 @@ public BasicCouchbasePersistentProperty(Property property, | |||
*/ | |||
@Override | |||
public String getFieldName() { | |||
|
|||
if (isIdProperty() && getOwner().getIdProperty().equals(this)) return ID_FIELD_NAME; | |||
if (isVersionProperty()) return VERSION_FIELD_NAME; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style NIT: would be good to use braces, even for single-statement blocks.
return "`" + source.getFieldName() + "`"; | ||
} | ||
}; | ||
(source) -> META_PROPERTIES.contains(source.getFieldName()) ? "META()." + source.getFieldName() : "`" + source.getFieldName() + "`"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the document has a normal property called "id", "cas", or "expiration" -- can the user still reference it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes good point, will change the check to use the annotations instead and add the prefix.
@@ -60,18 +63,15 @@ | |||
* @author Mark Paluch | |||
*/ | |||
public class N1qlUtils { | |||
//As per https://docs.couchbase.com/server/5.5/n1ql/n1ql-language-reference/indexing-meta-info.html | |||
final static Set<String> META_PROPERTIES = new HashSet<>(Arrays.asList("id", "expiration", "cas")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be private?
Closing for now, as there are conflicts. @bsubhashni if you can resolve the conflicts, we can get this re-reviewed and merged. |
@bsubhashni Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
1 similar comment
@bsubhashni Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
…cates
Change part tree based N1ql query construction for metadata properties
to add meta prefix. The metadata information stored as properties are
version and id. The meta prefix is currently empty without the bucket name,
referring the bucket could be an enhancement in future, but it should not
break things as there is only one bucket involved in a repository part
tree query.