Skip to content
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

DATACOUCH-407 - Use meta prefix for metadata properties in N1ql predi… #175

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
4 participants
@bsubhashni
Copy link
Contributor

commented Sep 25, 2018

…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.

DATACOUCH-407 - Use meta prefix for metadata properties in N1ql predi…
…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;

This comment has been minimized.

Copy link
@dnault

dnault Feb 12, 2019

Collaborator

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() + "`";

This comment has been minimized.

Copy link
@dnault

dnault Feb 12, 2019

Collaborator

What happens if the document has a normal property called "id", "cas", or "expiration" -- can the user still reference it?

This comment has been minimized.

Copy link
@bsubhashni

bsubhashni Feb 12, 2019

Author Contributor

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"));

This comment has been minimized.

Copy link
@dnault

dnault Feb 12, 2019

Collaborator

Should this be private?

@davidkelly

This comment has been minimized.

Copy link
Collaborator

commented Jun 28, 2019

Closing for now, as there are conflicts. @bsubhashni if you can resolve the conflicts, we can get this re-reviewed and merged.

@davidkelly davidkelly closed this Jun 28, 2019

@pivotal-issuemaster

This comment has been minimized.

Copy link

commented Jun 28, 2019

@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
@pivotal-issuemaster

This comment has been minimized.

Copy link

commented Jun 28, 2019

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.