4.1.1 • Published 2 months ago

@azure/cosmos v4.1.1

Weekly downloads
72,177
License
MIT
Repository
-
Last release
2 months ago

Microsoft Azure Cosmos JavaScript SDK

This project provides JavaScript & Node.js SDK library for SQL API of Azure Cosmos Database Service. This project also includes samples, tools, and utilities.

latest npm badge Build Status Build Status

// JavaScript
const cosmos = require("@azure/cosmos");
const CosmosClient = cosmos.CosmosClient;

const endpoint = "[hostendpoint]"; // Add your endpoint
const masterKey = "[database account masterkey]"; // Add the masterkey of the endpoint
const client = new CosmosClient({ endpoint, auth: { masterKey } });

const databaseDefinition = { id: "sample database" };
const collectionDefinition = { id: "sample collection" };
const documentDefinition = { id: "hello world doc", content: "Hello World!" };

async function helloCosmos() {
  const { database: db } = await client.databases.create(databaseDefinition);
  console.log("created db");

  const { container } = await db.containers.create(collectionDefinition);
  console.log("created collection");

  const { body } = await container.items.create(documentDefinition);
  console.log("Created item with content: ", body.content);

  await db.delete();
  console.log("Deleted database");
}

helloCosmos().catch(err => {
  console.error(err);
});

Useful links

Need Help?

Tweet us with #CosmosDB and we'll respond on Twitter. Be sure to check out the Microsoft Azure Developer Forums on MSDN or the Developer Forums on Stack Overflow if you have trouble with the provided code.

Contribute Code or Provide Feedback

For our rules and guidelines on contributing, please see Microsoft's contributor guide.(https://docs.microsoft.com/en-us/contribute/).

For information on how build and test this repo, please see ./dev.md.

If you encounter any bugs with the library please file an issue in the Issues section of the project.

neudesic-chatbot-frameworkneudesic-chatbot-framework-v3@brewdatportal/dbhelpersormas-comloguf-server-azure-functionsce-auditpc-auditlog-a@project-carbon/sharedvh_component_test_copypc-versionhistory-spc-rulesengine-sjpc-rulesengine-sppc-auditlog-spc-notifications-spc-notifications-sh@cocs/commondha-cms-clientbun-common@everything-registry/sub-chunk-107forms-services-commonwin-fiba-function-public-devshelby.vosample-configurationssengi-cosmosdbsengi-docstore-cosmosdb@cae-cobalt/cae-webflow-librarymirbotjsonotron-cosmosdbisatdatapro-microservicesio-opsio-functions-commonsirontaskirontask-devtestlemon-core-v4-azuremoleculer-db-adapter-cosmoskeyv-cosmosjazz-azure-climashuply-apinode-cosmosprimeobjects-helper-servicenestjs-azure-cosmospc-configurations-sppc-auditlog-sppc-audittrail-sppc-notifications-sppc-rulesengine-viswanode-red-contrib-cosmos-dbphotone4-auditn8n-nodes-no-pain-no-gain-packagenode-red-cosmos-r2rads-serverstreamsoftco-productionrward-backendtriplecheck-repository-cosmosdb-sql@ayitechnologies/housekeepercommon@azberry/az-simple@blackie-ops/cosmosdb@brewdatportal/cosmos@cellaware/utils@adearriba/shopify-app-session-storage-cosmosdb@aaronpowell/graphql-cosmosdb-subscriptions@aaxis/azure-database@abouroubi/azure-database@lordly/models@cloudnativegbb/cosmos-odm@cocs/shared@br-js/node-cosmosdb@boostercloud/framework-provider-azure@boostercloud/framework-provider-azure-infrastructurevirtualsystems.utilities.coreunified-serverless-storage@htran233/cosmos-orm@foxmn/azure-database@kth/kth-node-cosmos-db@kumologica/kumologica-contrib-cosmosdb@llm-tools/embedjs-cosmos@langchain/azure-cosmosdb@micro-module/cosmos-api-lib@matrx/svelte-realtime-adapter-cosmos-db-temporal@nestjs/azure-database@exabugs/da-cosmos@mattmazzola/sdk@mcma/azure-cosmos-db@jeff-king/sarif-web-component@hmcts/gatling-hoover@hypertext.solutions/simple-documentdb-client@nordicsemiconductor/asset-tracker-cloud-azure@qbcart/cosmos@project-alcatraz/graphql-mesh-cosmos@pi-r/azure@paddleboard/core@pagopa/io-functions-commons@srascar/galaxy-migrations@digitallinguistics/db@conversationlearner/sdk@dinohorvat/azure-database@dinohorvat/azure-db@roopakv/sarif-web-componentencodeagent-helper-serviceexpress-session-cosmosdb
4.1.1

4 months ago

4.1.0

5 months ago

4.0.1-beta.2

11 months ago

4.0.1-beta.3

7 months ago

4.0.1-beta.1

11 months ago

4.0.0

1 year ago

3.17.3

2 years ago

3.17.4-beta.1

2 years ago

3.17.2

2 years ago

3.17.0

2 years ago

3.17.1

2 years ago

3.16.1

3 years ago

3.16.0

3 years ago

3.16.3

2 years ago

3.16.2

2 years ago

3.16.4

2 years ago

3.15.0

3 years ago

3.15.1

3 years ago

3.14.1

3 years ago

3.14.0

3 years ago

3.13.1

3 years ago

3.13.0

3 years ago

3.12.3

3 years ago

3.12.2

3 years ago

3.12.1

3 years ago

3.12.0

3 years ago

3.11.4

4 years ago

3.11.5

4 years ago

3.11.3

4 years ago

3.11.0

4 years ago

3.11.2

4 years ago

3.11.1

4 years ago

3.10.6

4 years ago

3.10.5

4 years ago

3.10.4

4 years ago

3.10.3

4 years ago

3.10.2

4 years ago

3.10.1

4 years ago

3.10.0

4 years ago

3.9.5

4 years ago

3.9.3

4 years ago

3.9.2

4 years ago

3.9.1

4 years ago

3.9.0

4 years ago

3.8.1

4 years ago

3.8.0

4 years ago

3.7.4

4 years ago

3.7.3

4 years ago

3.7.2

5 years ago

3.7.1

5 years ago

3.7.0

5 years ago

3.6.3

5 years ago

3.6.2

5 years ago

3.6.1

5 years ago

3.6.0

5 years ago

3.5.4

5 years ago

3.5.3

5 years ago

3.5.2

5 years ago

3.5.1

5 years ago

3.5.0

5 years ago

3.4.2

5 years ago

3.4.1

5 years ago

3.4.0

5 years ago

3.3.6

5 years ago

3.3.5

5 years ago

3.3.4

5 years ago

3.3.3

5 years ago

3.3.2

5 years ago

3.3.1

5 years ago

3.3.0

5 years ago

3.2.0

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.4

5 years ago

3.0.3

5 years ago

3.0.2

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

3.0.0-22

5 years ago

2.1.7

5 years ago

3.0.0-21

6 years ago

3.0.0-20

6 years ago

2.1.6

6 years ago

3.0.0-19

6 years ago

3.0.0-18

6 years ago

3.0.0-17

6 years ago

3.0.0-16

6 years ago

3.0.0-15

6 years ago

3.0.0-14

6 years ago

3.0.0-13

6 years ago

3.0.0-12

6 years ago

3.0.0-11

6 years ago

3.0.0-10

6 years ago

3.0.0-9

6 years ago

3.0.0-8

6 years ago

2.1.5

6 years ago

2.1.4

6 years ago

2.1.3

6 years ago

3.0.0-7

6 years ago

2.1.2

6 years ago

3.0.0-6

6 years ago

3.0.0-5

6 years ago

3.0.0-4

6 years ago

3.0.0-3

6 years ago

3.0.0-2

6 years ago

3.0.0-1

6 years ago

3.0.0-0

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

2.0.0-4

6 years ago

2.0.0-3

6 years ago

2.0.0-0

7 years ago