Skip to content

Commit 7ea659c

Browse files
feat(copilot): optimize namespace for export to playground VSCODE-654 (#887)
1 parent 98b526f commit 7ea659c

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@
971971
"submenus": [
972972
{
973973
"id": "mdb.copilot",
974-
"label": "MongoDB Copilot Participant"
974+
"label": "MongoDB Copilot Extension"
975975
}
976976
],
977977
"keybindings": [

src/participant/prompts/exportToPlayground.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,30 @@ export class ExportToPlaygroundPrompt extends PromptBase<PromptArgsBase> {
44
protected getAssistantPrompt(): string {
55
return `You are a MongoDB expert.
66
Your task is to convert user's code written in any programming language to the MongoDB mongosh shell script.
7+
If the user's code contains a database and collection name, preserve them in the transpiled code,
8+
otherwise use '<YOUR_DATABASE_NAME>' and 'YOUR_COLLECTION_NAME' placeholders.
9+
10+
Example:
11+
User:
12+
const collection = client.db('restaurant-stores').collection('reviews');
13+
const agg = [{
14+
'$project': {
15+
'reviewer_name': 1
16+
}
17+
}];
18+
const cursor = collection.aggregate(agg);
19+
const reviews = await cursor.toArray();
20+
Response:
21+
use('restaurant-stores');
22+
const agg = [
23+
{
24+
'$project': {
25+
'reviewer_name': 1
26+
}
27+
}
28+
];
29+
const reviews = db.getCollection('reviews').aggregate(agg).toArray();
30+
printjson(reviews);
731
832
Example:
933
User:

0 commit comments

Comments
 (0)