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

DOC-7628 scope/collection analytics examples #20

Closed
wants to merge 2 commits into from

Conversation

osfameron
Copy link
Collaborator

The scope example is commented out, as I don't understand the
API here, have asked for advice from @avsej and will uncomment/fix in due course.

The scope example is commented out, as I don't understand the
API here, am investigating and will fix/uncomment.
@osfameron
Copy link
Collaborator Author

Currently, uncommenting the handle-scope section gives this error:

.../.rvm/gems/ruby-3.0.0/gems/couchbase-3.0.3/lib/couchbase/scope.rb:102:in `analytics_query': uninitialized constant Couchbase::Scope::AnalyticsResult (NameError)
	from modules/howtos/examples/analytics.rb:91:in `<main>'

This is with the following datasets created:

  CREATE DATAVERSE `travel-sample.inventory`;
  USE `travel-sample.inventory`;
  CREATE DATASET `airports-collection` ON `travel-sample`.inventory.airport;

This seems to match the conventions documented in the Java implementation of RFC, and does work in the Java SDK, so I'm not sure if the Ruby SDK is incomplete here?

A recommended way to create an Analytics collection is e.g.

   ALTER COLLECTION `travel-sample`.`inventory`.`airport` ENABLE ANALYTICS;

This creates a dataverse with a name like

   `travel-sample`.inventory

However the scope example now gives an error like:

   .rvm/gems/ruby-3.0.0/gems/couchbase-3.0.3/lib/couchbase/scope.rb:100:
      in `document_analytics': unable to execute analytics query
      (24034: Cannot find dataverse with name `travel-sample.inventory`):
       dataverse_not_found, context={...
@osfameron osfameron changed the title (WIP do not merge) DOC-7628 scope/collection analytics examples DOC-7628 scope/collection analytics examples Mar 24, 2021

[source,ruby]
----
include::../examples/analytics.rb[tag=handle-collection]
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure what extra macro power Antora derives from using example$ in place of ../example/
(I'd need to rtfm ;) )
but I'm pretty sure that there was a reason beyond cargo-culting why we do this.

Copy link
Contributor

@RichardSmedley RichardSmedley left a comment

Choose a reason for hiding this comment

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

No problem merging from the adoc pov (although see passing comment on example$),
if @avsej has no time to review the code, I'm happy for it to be merged as working,
and we can revisit later if necessary.

@osfameron
Copy link
Collaborator Author

Thanks. I've made a few fixes including the example$ one you mention, but in the correct branch (oops), so I'll close this PR and reissue, sorry for confusion.

@osfameron
Copy link
Collaborator Author

see #27

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.

2 participants