Skip to content

Instantly share code, notes, and snippets.

@duggan
Created August 2, 2014 21:47
Show Gist options
  • Select an option

  • Save duggan/1b42cddf34c419db824d to your computer and use it in GitHub Desktop.

Select an option

Save duggan/1b42cddf34c419db824d to your computer and use it in GitHub Desktop.
RethinkDB: is it possible to supply ["foo", "def"] to a query on this table and return just the third document?
{
id: 1,
title: "Foo post",
tags: ["foo", "bar", "baz"]
},
{
id: 2,
title: "Bar post",
tags: ["abc", "def", "ghi"]
},
{
id: 3,
title: "Baz post",
tags: ["foo", "def", "buzz"]
},
@duggan

duggan commented Aug 2, 2014

Copy link
Copy Markdown
Author

Answer is:

r.table("documents").filter(r.row("tags").contains("foo", "def"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment