Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 35 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/compass-collection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"reformat": "npm run eslint . -- --fix && npm run prettier -- --write ."
},
"dependencies": {
"@faker-js/faker": "^9.0.0",
"@faker-js/faker": "^10.4.0",
"@mongodb-js/atlas-service": "^0.85.1",
"@mongodb-js/compass-assistant": "^1.33.1",
"@mongodb-js/compass-app-registry": "^9.11.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ export const MongoDBFieldTypeValues: MongoDBFieldType[] = [
];

/**
* Map of MongoDB types to available Faker v9 methods.
* Map of MongoDB types to available Faker v10 methods.
* Not all Faker methods are included here.
* More can be found in the Faker.js API: https://v9.fakerjs.dev/api/
* More can be found in the Faker.js API: https://v10.fakerjs.dev/api/
*/
export const MONGO_TYPE_TO_FAKER_METHODS: Readonly<
Record<MongoDBFieldType, Array<{ method: string; description?: string }>>
Expand All @@ -70,7 +70,7 @@ export const MONGO_TYPE_TO_FAKER_METHODS: Readonly<
{ method: 'internet.password', description: 'Randomly generated password' },
{ method: 'internet.url' },
{ method: 'internet.domainName' },
{ method: 'internet.userName' },
{ method: 'internet.username' },
{ method: 'phone.number' },
{ method: 'location.city' },
{ method: 'location.country' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ const ScriptScreen = ({
onScriptCopy({ step: DataGenerationSteps.INSTALL_FAKERJS })
}
>
npm install @faker-js/faker@9
npm install @faker-js/faker@10
</Copyable>
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

The generated instructions now tell users to install @faker-js/faker@10, but @faker-js/faker@10.4.0 declares engines node: ^20.19.0 || ^22.13.0 || … and npm: >=10 (see package-lock). Users on older Node/npm will hit install/engine errors. Consider adding a Node/npm minimum-version note in the Prerequisites UI (or choosing a faker major/version that matches the supported user runtime).

Suggested change
</Copyable>
</Copyable>
<Body className={instructionTextStyle}>
<strong>Note:</strong> <InlineCode>@faker-js/faker@10</InlineCode>{' '}
requires Node.js <InlineCode>20.19.0+</InlineCode> and npm{' '}
<InlineCode>10+</InlineCode>. If you&apos;re using an older
runtime, upgrade Node.js and npm before running this install
command.
</Body>

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Runtime fails on mongosh < 2.5 (pre-Node-20.19). Thoughts on adding a note "Requires mongosh 2.5 or later"?

</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-generative-ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"zod": "^3.25.76"
},
"devDependencies": {
"@faker-js/faker": "^9.0.0",
"@faker-js/faker": "^10.4.0",
"@mongodb-js/eslint-config-compass": "^1.4.22",
"@mongodb-js/mocha-config-compass": "^1.8.0",
"@mongodb-js/prettier-config-compass": "^1.2.9",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ Transform the provided MongoDB collection schema into a JSON response containing
* **DO NOT** modify, shorten, or transform field names

## 2. Faker Method Selection
* Use valid faker.js methods from version ^9.0.0
* Use valid faker.js methods from version ^10.4.0
* Format: \`<module>.<method>\` (e.g., \`person.firstName\`, \`date.past\`, \`number.int\`)
* **DO NOT** invent methods that don't exist in faker.js
* **DO NOT** use "unrecognized" unless no reasonable faker.js method exists - prefer a reasonable guess

### Available Faker.js Methods by MongoDB Type

**String fields**: person.firstName, person.lastName, person.fullName, person.jobTitle, internet.email, internet.userName, internet.url, image.url, internet.domainName, internet.password, internet.displayName, internet.emoji, location.city, location.country, location.streetAddress, location.state, location.zipCode, company.name, company.catchPhrase, color.human, commerce.productName, commerce.department, finance.accountName, finance.currencyCode, phone.number, git.commitSha, string.uuid, string.alpha, string.alphanumeric, lorem.word, lorem.words, lorem.sentence, lorem.paragraph, system.fileName, system.filePath, system.mimeType, book.title, music.songName, food.dish, animal.type, vehicle.model, vehicle.manufacturer, hacker.phrase, science.chemicalElement
**String fields**: person.firstName, person.lastName, person.fullName, person.jobTitle, internet.email, internet.username, internet.url, image.url, internet.domainName, internet.password, internet.displayName, internet.emoji, location.city, location.country, location.streetAddress, location.state, location.zipCode, company.name, company.catchPhrase, color.human, commerce.productName, commerce.department, finance.accountName, finance.currencyCode, phone.number, git.commitSha, string.uuid, string.alpha, string.alphanumeric, lorem.word, lorem.words, lorem.sentence, lorem.paragraph, system.fileName, system.filePath, system.mimeType, book.title, music.songName, food.dish, animal.type, vehicle.model, vehicle.manufacturer, hacker.phrase, science.chemicalElement

**Number/Int32 fields**: number.int, number.float, number.binary, number.octal, number.hex, date.weekday, internet.port, location.latitude, location.longitude

Expand Down Expand Up @@ -95,6 +95,7 @@ When MongoDB schema validation rules are provided:
* **CRITICAL - DO NOT**: Serialize primitives as JSON strings (e.g., \`{"json": "3"}\` is WRONG)
* **CRITICAL - DO NOT**: Use unescaped quotes in JSON strings - always escape inner quotes with \`\\"\`
* **CRITICAL - DO NOT**: Include unnecessary arguments - if no sample values or constraints, use \`[]\`
* **CRITICAL - DO NOT**: Pass a format template string to \`phone.number\` (e.g. \`"+1-###-###-####"\`). Faker v10 removed the positional format-string signature — always use \`fakerArgs: []\` for \`phone.number\`.

### JSON Escaping Examples
* Simple object: \`{"json": "{\\"min\\": 1, \\"max\\": 10}"}\`
Expand Down
5 changes: 2 additions & 3 deletions packages/compass-generative-ai/tests/evals/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ const GENERIC_STRING_METHODS = new Set<string>([
'helpers.arrayElement',
// Common semantic string methods the LLM reasonably picks when it can
// read meaning from the field name (e.g. `customer` → person/company;
// `name` → product name; `category` → department). All of these return
// strings.
// `name` → product name). All of these return strings.
'person.firstName',
'person.lastName',
'person.fullName',
Expand All @@ -192,7 +191,7 @@ const GENERIC_STRING_METHODS = new Set<string>([
'commerce.productName',
'commerce.department',
'commerce.product',
'internet.userName',
'internet.username',
'internet.displayName',
'internet.domainName',
'book.title',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1831,12 +1831,8 @@ export const mflixMovieCase: MockDataGeneratorCaseConfig = {
},
{
fieldPath: 'cast[]',
fakerMethod: 'helpers.arrayElement',
fakerArgs: [
{
json: '["Paul Muni", "Ann Dvorak", "Karen Morley", "Osgood Perkins"]',
},
],
fakerMethod: 'person.fullName',
fakerArgs: [],
},
{
fieldPath: 'num_mflix_comments',
Expand Down Expand Up @@ -1865,17 +1861,13 @@ export const mflixMovieCase: MockDataGeneratorCaseConfig = {
},
{
fieldPath: 'directors[]',
fakerMethod: 'helpers.arrayElement',
fakerArgs: [{ json: '["Howard Hawks", "Richard Rosson"]' }],
fakerMethod: 'person.fullName',
fakerArgs: [],
},
{
fieldPath: 'writers[]',
fakerMethod: 'helpers.arrayElement',
fakerArgs: [
{
json: '["Armitage Trail (novel)", "Ben Hecht (screen story)", "Seton I. Miller (continuity)", "John Lee Mahin (continuity)", "W.R. Burnett (continuity)", "Seton I. Miller (dialogue)", "John Lee Mahin (dialogue)", "W.R. Burnett (dialogue)"]',
},
],
fakerMethod: 'person.fullName',
fakerArgs: [],
},
{
fieldPath: 'awards.wins',
Expand Down
Loading