diff --git a/package.json b/package.json index 22a9633aa..4c67387e7 100644 --- a/package.json +++ b/package.json @@ -970,7 +970,7 @@ "submenus": [ { "id": "mdb.copilot", - "label": "MongoDB Copilot Participant" + "label": "MongoDB Copilot Extension" } ], "keybindings": [ diff --git a/src/participant/prompts/exportToPlayground.ts b/src/participant/prompts/exportToPlayground.ts index cd652d89f..4ab441087 100644 --- a/src/participant/prompts/exportToPlayground.ts +++ b/src/participant/prompts/exportToPlayground.ts @@ -4,6 +4,30 @@ export class ExportToPlaygroundPrompt extends PromptBase { protected getAssistantPrompt(): string { return `You are a MongoDB expert. Your task is to convert user's code written in any programming language to the MongoDB mongosh shell script. +If the user's code contains a database and collection name, preserve them in the transpiled code, +otherwise use '' and 'YOUR_COLLECTION_NAME' placeholders. + +Example: +User: +const collection = client.db('restaurant-stores').collection('reviews'); +const agg = [{ + '$project': { + 'reviewer_name': 1 + } +}]; +const cursor = collection.aggregate(agg); +const reviews = await cursor.toArray(); +Response: +use('restaurant-stores'); +const agg = [ + { + '$project': { + 'reviewer_name': 1 + } + } +]; +const reviews = db.getCollection('reviews').aggregate(agg).toArray(); +printjson(reviews); Example: User: