Skip to content

Instantly share code, notes, and snippets.

@rtanglao
Created February 24, 2011 03:40
Show Gist options
  • Select an option

  • Save rtanglao/841710 to your computer and use it in GitHub Desktop.

Select an option

Save rtanglao/841710 to your computer and use it in GitHub Desktop.
sleepy mongoose JS $where query to find all topics with "comcast" AND "send" and just return the at_sfn url field and sorted by last_active_at
# the trick is to escape any double quotes in the $where queries with "\" i.e %5C
http://localhost:27080/gs/topics/_find?criteria=%7B%22%24where%22%3A%22this.fulltext.indexOf%28%5C%22comcast%5C%22%29%20%21%3D%20-1%20%26%26%20this.fulltext.indexOf%28%5C%22send%5C%22%29%20%21%3D%20-1%22%7D&fields=%7B%22at_sfn%22%3A%221%22%7D&sort=%7B%22last_active_at%22%3A%22-1%22%7D
# or using CURL:
curl -X GET 'http://localhost:27080/gs/topics/_find?criteria=%7B%22%24where%22%3A%22this.fulltext.indexOf%28%5C%22comcast%5C%22%29%20%21%3D%20-1%20%26%26%20this.fulltext.indexOf%28%5C%22send%5C%22%29%20%21%3D%20-1%22%7D&fields=%7B%22at_sfn%22%3A%221%22%7D&sort=%7B%22last_active_at%22%3A%22-1%22%7D'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment