GithubHelp home page GithubHelp logo

yonet / azure-cosmos-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from azure/azure-cosmos-js

0.0 2.0 0.0 11.53 MB

@azure/cosmos has moved to a new repo https://github.com/Azure/azure-sdk-for-js

License: MIT License

JavaScript 0.62% TypeScript 99.38%

azure-cosmos-js's Introduction

🚨This SDK is now maintained at https://github.com/Azure/azure-sdk-for-js 🚨

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

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

const endpoint = "https://your-account.documents.azure.com"; // Add your endpoint
const key = "[database account masterkey]"; // Add the masterkey of the endpoint
const client = new CosmosClient({ endpoint, key });

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

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

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

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

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

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

Install via NPM

You can install the npm package using the following command:

npm install @azure/cosmos

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.

azure-cosmos-js's People

Contributors

1n50mn14 avatar a8m avatar aliuy avatar ashleygrant avatar ato9000 avatar bchong95 avatar bterlson avatar bursteg avatar christopheranderson avatar craigshoemaker avatar dmitriykirakosyan avatar dwhieb avatar fkollmann avatar igorklopov avatar joaomoreno avatar khdang avatar kirankumarkolli avatar lmaccherone avatar moderakh avatar molant avatar nomiero avatar nschonni avatar pacific202 avatar rnagpal avatar ronaldewatts avatar ryancrawcour avatar shipunyc avatar southpolesteve avatar ytechie avatar ziyel avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.