Show the JSON document when referring to it in examples
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 118
- Forks
- 161
- PR merge metrics
- No merged PRs in 30d
Description
The docs for RethinkDb are great, but there are a few areas that I think would help. In particular where ReQL is being explained, often there is no sale doc provided where you can follow along. A case in point is secondary indexes (https://rethinkdb.com/docs/secondary-indexes/javascript/) where it shows a lot of samples, but no context to the document being operated on.
For example when I was having issues with a secondary index, I posted in Slack the document (like below)
{
"first_name": "William",
"id": "00039f57-4744-4621-88a9-ccd93c36fd25",
"last_name": "Murphy",
"member_since": "2015-11-29",
"password": "password",
"products": [{
"product": "ABC Blocks",
"product_id": "e9b3605d-8fbd-40d4-ba6b-cf4acf08bced",
"product_type": "toy",
"status": "owned"
}, {
"product": "Reading Time",
"product_id": "48506714-3131-4f49-930c-c199567a2bb7",
"product_type": "book",
"status": "owned"
}, {
"product": "Reading Time",
"product_id": "0a0c4217-6705-4c78-828f-b46624eddcfb",
"product_type": "book",
"status": "wanted"
}],
"username": "WMurphy3792"
}
Which helped get an answer (from Shaggydev) of
r.table("users").indexCreate("status_product", function(user) {
return user("products").map(function(product) {
return [ product("status"), product('product_id') ]
})
}, {multi: true})
I also showed how I wanted to use the index
r.table('users').getAll(['wishlist', 'dbabe660-473f-471f-829e-039c451c6872'], {index:'status_product'})
And probably could have included a note about what it was I was trying to accomplish, like
I want to be able to get all users for a specific product based on the status (owned or wishlist)
So maybe some format like that, where you get the doc, and explanation, the index creation nd the query to use the index would be nice.
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 with the secondary indexes JavaScript page linked in the issue and review its ReQL examples alongside the supplied users document. Update the relevant examples with enough document context and explain the index creation and lookup; the page is done when readers can follow the examples and understand the intended query result.
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
- 48/100