File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 971
971
"submenus" : [
972
972
{
973
973
"id" : " mdb.copilot" ,
974
- "label" : " MongoDB Copilot Participant "
974
+ "label" : " MongoDB Copilot Extension "
975
975
}
976
976
],
977
977
"keybindings" : [
Original file line number Diff line number Diff line change @@ -4,6 +4,30 @@ export class ExportToPlaygroundPrompt extends PromptBase<PromptArgsBase> {
4
4
protected getAssistantPrompt ( ) : string {
5
5
return `You are a MongoDB expert.
6
6
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);
7
31
8
32
Example:
9
33
User:
You can’t perform that action at this time.
0 commit comments