Skip to content

Conversation

alenakhineika
Copy link
Contributor

In mongosh, we don't have MongoDB user identifiers. We randomly generate an ID the first time the product is run and then we use that as a user id. The userId should not be a random UUID, it should store only AUID. The randomly generated UUID should be sent as anonymousId.

To not break statistics for existing users:

  • We should leave all current users with the tracking they have.
  • For new users, we should use the anonymousID field and fill it with a random UUID.

That being said:

  • If userId exists we send it to segment. We also copy userId to anonymousId and send it to Segment as well.
  • If userId does not exist we do not create a new one, we only generate a random UUID and send it to Segment as anonymousId.

Copy link
Collaborator

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

Looks good, might be nice to also have somebody take a look who reviewed the vscode/compass variants of this tho

@addaleax
Copy link
Collaborator

Also, I think the test failure in the types package might be related:

[2022/03/10 12:15:38.129]   1) config validation
[2022/03/10 12:15:38.129]        validates config option values:
[2022/03/10 12:15:38.129]      AssertionError: expected null to equal undefined
[2022/03/10 12:15:38.129]       at Context.<anonymous> (src/index.spec.ts:7:48)

@alenakhineika alenakhineika requested a review from mcasimir March 10, 2022 14:31
Copy link
Collaborator

@mcasimir mcasimir left a comment

Choose a reason for hiding this comment

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

👍

@alenakhineika alenakhineika merged commit 7b46227 into main Mar 14, 2022
@alenakhineika alenakhineika deleted the MONGOSH-1143-user-id-and-anonymous-id-segment branch March 14, 2022 11:36
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