@@ -4,24 +4,24 @@ exports = async function (arg) {
4
4
// https://www.mongodb.com/docs/atlas/app-services/functions/
5
5
6
6
// Find the name of the MongoDB service you want to use (see "Linked Data Sources" tab)
7
- var serviceName = "mongodb-atlas" ;
7
+ const serviceName = "mongodb-atlas" ;
8
8
9
9
// Update these to reflect your db/collection
10
- var dbName = "db_name" ;
11
- var collName = "coll_name" ;
10
+ const dbName = "db_name" ;
11
+ const collName = "coll_name" ;
12
12
13
13
// Get a collection from the context
14
- var collection = context . services
14
+ const collection = context . services
15
15
. get ( serviceName )
16
16
. db ( dbName )
17
17
. collection ( collName ) ;
18
18
19
- var findResult ;
19
+ let findResult ;
20
20
try {
21
21
// Get a value from the context (see "Values" tab)
22
22
// Update this to reflect your value's name.
23
- var valueName = "value_name" ;
24
- var value = context . values . get ( valueName ) ;
23
+ const valueName = "value_name" ;
24
+ const value = context . values . get ( valueName ) ;
25
25
26
26
// Execute a FindOne in MongoDB
27
27
findResult = await collection . findOne ( {
@@ -36,7 +36,7 @@ exports = async function (arg) {
36
36
}
37
37
38
38
// To call other named functions:
39
- // var result = context.functions.execute("function_name", arg1, arg2);
39
+ // const result = context.functions.execute("function_name", arg1, arg2);
40
40
41
41
return { result : findResult } ;
42
42
} ;
0 commit comments