Skip to content

Instantly share code, notes, and snippets.

@avsej
Forked from johnzablocki/gist:3621597
Created September 4, 2012 14:28
Show Gist options
  • Save avsej/3621659 to your computer and use it in GitHub Desktop.
Save avsej/3621659 to your computer and use it in GitHub Desktop.
Couchbase Ruby Client Library Doc Insert and View Query
new_beer = {"name" => "Atlantic Amber"}
client.add("beer_Atlantic_Amber", new_beer)
view = client.design_docs["beers"].by_name(:key => "Atlantic Amber", :limit => 1)
view.each do |beer|
puts beer["name"]
end
# or
view = client.design_docs["beers"].by_name
view.each(:key => "Atlantic Amber", :limit => 1) do |beer|
puts beer["name"]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment