Skip to content

Commit 9f08b2d

Browse files
Merge pull request #36873 from southpolesteve/patch-6
Update to reflect API changes in v3 Cosmos JS SDK
2 parents 41d383a + 22f3da1 commit 9f08b2d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

articles/azure-functions/manage-connections.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@ public static async Task Run(string input)
112112
```javascript
113113
const cosmos = require('@azure/cosmos');
114114
const endpoint = process.env.COSMOS_API_URL;
115-
const masterKey = process.env.COSMOS_API_KEY;
115+
const key = process.env.COSMOS_API_KEY;
116116
const { CosmosClient } = cosmos;
117117

118-
const client = new CosmosClient({ endpoint, auth: { masterKey } });
118+
const client = new CosmosClient({ endpoint, key });
119119
// All function invocations also reference the same database and container.
120120
const container = client.database("MyDatabaseName").container("MyContainerName");
121121

122122
module.exports = async function (context) {
123-
const { result: itemArray } = await container.items.readAll().toArray();
123+
const { resources: itemArray } = await container.items.readAll().fetchAll();
124124
context.log(itemArray);
125125
}
126126
```

0 commit comments

Comments
 (0)