Skip to content

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

Closed
wants to merge 1 commit into from
Closed

Conversation

bsubhashni
Copy link
Contributor

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

…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;
Copy link
Contributor

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

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?

Copy link
Contributor Author

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"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be private?

@davidkelly
Copy link
Contributor

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
Copy link

@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
Copy link

@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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants