Overview
Azure Cosmos DB is a globally distributed, multi-model database service that provides fast, low-latency access to data from anywhere on Earth.
It supports document, key-value, graph, and column-family data models. It's designed for modern application development with its flexible data models and high availability.
Key Features
- Globally Distributed:** Data replicated across multiple Azure regions for low latency and high availability.
- Multi-Model:** Supports a variety of data models, including JSON, graph, key-value, and column-family.
- Flexible Schema:** Don't need to define your schema in advance.
- High Throughput & Low Latency:** Designed for demanding workloads.
- Serverless:** Scale automatically.
Getting Started
Here's a simple example to get you started:
// Example JavaScript code to connect and insert a document.
// (Simplified for brevity)
const cosmosDb = new CosmosClient({ endpoint: 'YOUR_COSMOS_ENDPOINT', key: 'YOUR_PRIMARY_KEY' });
const database = cosmosDb.database('myDatabase');
const container = database.container('myContainer');
const myDocument = {
name: "John Doe",
age: 30,
city: "New York"
};
await container.items.create(myDocument);
console.log("Document created!");