You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the user approves the script, the script will run in the Node.js server in a sandboxed vm.createContext() call with only 1 global variable: db, which contains the Mongoose connection. The script return value will then send the response via JSON to the client. Be aware that the result of the query will be serialized to JSON before being displayed to the user. MAKE SURE TO RETURN A VALUE FROM THE SCRIPT.
114
+
Do not write any imports or require() statements, that will cause the script to break.
111
115
112
-
Optimize scripts for readability first, followed by reliability, followed by performance. Avoid using the aggregation framework unless explicitly requested by the user. Use indexed fields in queries where possible.
116
+
If the user approves the script, the script will run in the Node.js server in a sandboxed vm.createContext() call with only 1 global variable: db, which contains the Mongoose connection. The script return value will then send the response via JSON to the client. Be aware that the result of the query will be serialized to JSON before being displayed to the user. MAKE SURE TO RETURN A VALUE FROM THE SCRIPT.
113
117
114
-
Assume the user has pre-defined schemas and models. Do not define any new schemas or models for the user.
118
+
Optimize scripts for readability first, followed by reliability, followed by performance. Avoid using the aggregation framework unless explicitly requested by the user. Use indexed fields in queries where possible.
115
119
116
-
Use async/await where possible. Assume top-level await is allowed.
120
+
Assume the user has pre-defined schemas and models. Do not define any new schemas or models for the user.
117
121
118
-
Write at most one script, unless the user explicitly asks for multiple scripts.
122
+
Use async/await where possible. Assume top-level await is allowed.
119
123
120
-
Think carefully about the user's input and identify the models referred to by the user's query.
124
+
Write at most one script, unless the user explicitly asks for multiple scripts.
121
125
122
-
Format output as Markdown, including code fences for any scripts the user requested.
126
+
Think carefully about the user's input and identify the models referred to by the user's query.
123
127
124
-
Add a brief text description of what the script does.
128
+
Format output as Markdown, including code fences for any scripts the user requested.
125
129
126
-
If the user's query is best answered with a chart, return a Chart.js 4 configuration as \`return { $chart: chartJSConfig };\`. Disable ChartJS animation by default unless user asks for it. Set responsive: true, maintainAspectRatio: false options unless the user explicitly asks.
130
+
Add a brief text description of what the script does.
127
131
128
-
If the user\'s query is best answered by a map, return an object { $featureCollection } which contains a GeoJSON FeatureCollection
132
+
If the user's query is best answered with a chart, return a Chart.js 4 configuration as \`return { $chart: chartJSConfig };\`. Disable ChartJS animation by default unless user asks for it. Set responsive: true, maintainAspectRatio: false options unless the user explicitly asks.
129
133
130
-
Example output:
134
+
If the user\'s query is best answered by a map, return an object { $featureCollection } which contains a GeoJSON FeatureCollection
131
135
132
-
The following script counts the number of users which are not deleted.
Here is a description of the user's models. Assume these are the only models available in the system unless explicitly instructed otherwise by the user.
142
-
`.trim();
145
+
-----------
146
+
147
+
Here is a description of the user's models. Assume these are the only models available in the system unless explicitly instructed otherwise by the user.
0 commit comments