Skip to content

Instantly share code, notes, and snippets.

@charl
Created January 10, 2013 09:06
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 charl/4500622 to your computer and use it in GitHub Desktop.
Save charl/4500622 to your computer and use it in GitHub Desktop.
What is the most efficient way to filter documents with a similar structure to the one below based on the 'expanded_url' key's value. There are two more general questions here: * How do you filter documents based on a nested key(s)? * How do you filter documents based on the value of a key that resolves to an array of objects?
{
"created_at": "Tue, 01 Jan 2013 12:55:09 +0000",
"entities": {
"hashtags": [{
"text": "Clojure",
"indices": [39, 47]
}],
"urls": [{
"url": "http://t.co/ythjuG5U",
"expanded_url": "http://benchmarksgame.alioth.debian.org/u32/benchmark.php?test=all&lang=clojure&lang2=java",
"display_url": "benchmarksgame.alioth.debian.org/u32/benchmark.…",
"indices": [118, 138]
}],
"user_mentions": []
},
"from_user": "foo",
"from_user_id": 000000000,
"from_user_id_str": "000000000",
"from_user_name": "Foo Bar",
"geo": null,
"id": 0000000000000000000,
"id_str": "0000000000000000000",
"iso_language_code": "en",
"metadata": {
"result_type": "recent"
},
"profile_image_url": "http://example.com/profile_images/000000000/avatar_normal.png",
"profile_image_url_https": "https://si0.twimg.com/profile_images/000000000/avatar_normal.png",
"source": "<a href="http://twitter.com/">web</a>",
"text": "New \"Programming Clojure\" still claims #Clojure is at \"The speed of hand-written Java code\" when it clearly isn't :-( http://t.co/ythjuG5U",
"to_user": null,
"to_user_id": 0,
"to_user_id_str": "0",
"to_user_name": null
}
@coffeemug
Copy link

Discussion on this is here: rethinkdb/rethinkdb#211

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