Skip to content

Instantly share code, notes, and snippets.

@duggan
Created August 2, 2014 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duggan/1b42cddf34c419db824d to your computer and use it in GitHub Desktop.
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
Copy link
Author

duggan commented Aug 2, 2014

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