Add article on debugging techniques for reql
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 118
- Forks
- 161
- PR merge metrics
- No merged PRs in 30d
Description
Recently, there was a question on the mailing list asking about debugging a secondary index (to make sure it had the expected values in it). @danielmewes responded with this generally helpful technique:
secondary index debugging
An easy way to check which keys will be inserted into a secondary index is by running a .map(secondaryIndexFunction.default(null)) on the table. If you want to create a multi index, you can replace the map by concatMap.
Assuming that you want to create a multi index so that you can look up messages by the IDs of their responses (in JS):
r.table(...).indexCreate("resp_ids", function(x) { return x('response')('messages')('message-id'); }, {multi: true} )
other techniques
- turn a
.filterinto a.mapto see what's being matched - using
r.exprto create dummy data without needing to create a table to test a query on
@neumino and @AtnNn both have a huge bag of reql tricks, some of which I bet are good for debugging
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the appropriate ReQL documentation section and review the supplied secondary-index example using map, concatMap, and indexCreate. Incorporate the listed filter-to-map and r.expr techniques, with the JavaScript examples, and consider the article complete when these debugging techniques are clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100