-
Notifications
You must be signed in to change notification settings - Fork 1.9k
DOC-2737 - Adds JSON examples for Node.js #2642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: emb-examples
Are you sure you want to change the base?
Conversation
createClient | ||
} from 'redis'; | ||
|
||
const client = await createClient(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty sure this wont add json to the client. should need to specify it as a module on the client.
console.log(res2); // "Hyperion" | ||
|
||
const res3 = await client.json.type("bike", "$"); | ||
console.log(res3); // [ 'string' ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testing against v5, and in v5, this returns it outside of array syntax. need to understand what's going on.
// STEP_END | ||
|
||
// REMOVE_START | ||
assert.equal(res2, '"Hyperion"'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in v5, getting an error due to escaping of quotes it seems. unsure why
|
||
// STEP_START num | ||
const res7 = await client.json.set("crashes", "$", 0); | ||
console.log(res7) // True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we get back OK which seems right, not True. doesn't seem that different from line 16
const res12 = await client.json.get("newbike", "$"); | ||
console.log(res12); // ['["Deimos", { "crashes": 0 }, null]'] | ||
|
||
const res13 = await client.json.get("newbike", "$[1].crashes"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this returns same as above for me in v5
console.log(res14); // [1] | ||
|
||
const res15 = await client.json.get("newbike", "$"); | ||
console.log(res15); // [['Deimos', {'crashes': 0}]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this returns null for me, which I think is what I'd expect after above command?
const res22 = await client.json.get("riders", "$"); | ||
console.log(res22); // [['Prickett']] | ||
|
||
const res23 = await client.json.arrPop("riders", "$"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this changes in v5, the path is in a struct.
Description
Addresses this ticket:
https://redislabs.atlassian.net/browse/DOC-2737
Checklist
npm test
pass with this change (including linting)?