Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mongodb-js/vscode
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0bb216b6d3d898cc51d3c9d20244490316f3e494
Choose a base ref
..
head repository: mongodb-js/vscode
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 17da044f38c4f6f159b1cbe594e8ca06b7834bc8
Choose a head ref
Showing with 25 additions and 1 deletion.
  1. +1 −1 package.json
  2. +24 −0 src/participant/prompts/exportToPlayground.ts
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -971,7 +971,7 @@
"submenus": [
{
"id": "mdb.copilot",
"label": "MongoDB Copilot Participant"
"label": "MongoDB Copilot Extension"
}
],
"keybindings": [
24 changes: 24 additions & 0 deletions src/participant/prompts/exportToPlayground.ts
Original file line number Diff line number Diff line change
@@ -4,6 +4,30 @@ export class ExportToPlaygroundPrompt extends PromptBase<PromptArgsBase> {
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 '<YOUR_DATABASE_NAME>' 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: