Skip to content

Conversation

justincastilla
Copy link

@justincastilla justincastilla commented Jul 25, 2023

Description

Adds code examples for the Set tutorial

DOC-2553

https://redislabs.atlassian.net/browse/DOC-2295

Adds example code for Set datatype as per DOC-2295


Checklist

  • Does npm test pass with this change (including linting)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?

@justincastilla justincastilla changed the title Adds code examples for the set tutorial DOC-2553 - Adds code examples for the set tutorial Jul 25, 2023
await client.del('bikes:racing:usa')
// REMOVE_END

// STEP_START sAdd

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, case matters for step names.

Suggested change
// STEP_START sAdd
// STEP_START sadd

assert.equal(res4, 2)
// REMOVE_END

// STEP_START sIsMember

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// STEP_START sIsMember
// STEP_START sismember

assert.equal(res6, false)
// REMOVE_END

// STEP_START sinster

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// STEP_START sinster
// STEP_START sinter

assert.deepEqual(res7, [ 'bike:1' ])
// REMOVE_END

// STEP_START sCard

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// STEP_START sCard
// STEP_START scard

await client.del('bikes:racing:france')
// REMOVE_END

// STEP_START sAdd_sMembers

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// STEP_START sAdd_sMembers
// STEP_START sadd_smembers

assert.deepEqual(res10.sort(), ['bike:1', 'bike:2', 'bike:3'])
// REMOVE_END

// STEP_START smIsMember

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// STEP_START smIsMember
// STEP_START smismember

assert.deepEqual(res12, [true, true, false])
// REMOVE_END

// STEP_START sDiff

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// STEP_START sDiff
// STEP_START sdiff

await client.del('bikes:racing:italy')
// REMOVE_END

// STEP_START sRem

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// STEP_START sRem
// STEP_START srem

Copy link

@dwdougherty dwdougherty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added corrections to step case in multiple places. Please commit these changes. Otherwise, the docs build correctly.

Comment on lines +10 to +11
await client.del('bikes:racing:france')
await client.del('bikes:racing:usa')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for consistency user flushdb

Comment on lines +40 to +44
const res5 = await client.sIsMember('bikes:racing:usa', 'bike:1')
console.log(res5) // >>> true

const res6 = await client.sIsMember('bikes:racing:usa', 'bike:2')
console.log(res6) // >>> false
Copy link
Contributor

@sjpotter sjpotter Jun 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

returns 1/0 not true/false (at least in v5)

console.log(res11) // >>> true

const res12 = await client.smIsMember('bikes:racing:france', ['bike:2', 'bike:3', 'bike:4'])
console.log(res12) // >>> [true, true, false]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in v5, we now return 1/1/0 not true/true/false

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants