Skip to content

feat: Using the AtlasUserData class to demo save user data project COMPASS-9565 #7152

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

Draft
wants to merge 3 commits into
base: extend-user-data
Choose a base branch
from

Conversation

myang1220
Copy link
Contributor

Description

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@myang1220 myang1220 added feat no release notes Fix or feature not for release notes labels Jul 29, 2025
@myang1220 myang1220 changed the base branch from main to extend-user-data July 30, 2025 17:02
options.getResourceUrl,
options.authenticatedFetch,
{
serialize: (content) => EJSON.stringify(content, undefined, 2),
Copy link
Contributor

Choose a reason for hiding this comment

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

This is good for debugging but I'd expect us to use unspaced EJSON in prod

Comment on lines +107 to +108
// TODO: verify that this doesn't break anything in compass
const _id = new ObjectId().toHexString();
Copy link
Contributor

Choose a reason for hiding this comment

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

Was there something wrong with UUIDs?

Copy link
Contributor

Choose a reason for hiding this comment

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

In either case we haven't changed the type, just the string format, is that what we want here? just making sure if we want an ObjectId or UUID to be stored, we shouldn't toString this, we should leave it as the type we want

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this going to impact existing compass data that does use UUID?

Copy link
Contributor

Choose a reason for hiding this comment

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

Notes:

  • For now we will just make the zod schema support string without the uuid assertion.
  • We should consider storing OID directly to keep type information encoded into the format, just need to get zod to agree to that.
  • We need to handle migrations of existing compass files (-ish) depending on what relies on _id

abstract readOne(
id: string,
options?: ReadOptions
): Promise<z.output<T> | undefined>;
Copy link
Contributor

Choose a reason for hiding this comment

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

When does this return undefined? I kinda would've expected this to return a version of ReadAllResult that either has a single item in the arrays or the properties are one item instead of an array

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Identified that readOne in AtlasUserData should not be returning null when an error is found. readOne in FileUserData originally had a return type of Promise<z.output<T> | undefined>, so the abstract method should also have type undefined.

Comment on lines +107 to +108
// TODO: verify that this doesn't break anything in compass
const _id = new ObjectId().toHexString();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this going to impact existing compass data that does use UUID?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat no release notes Fix or feature not for release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants