$ -weight: 500;">npm -weight: 500;">install mongodb
-weight: 500;">npm -weight: 500;">install mongodb
-weight: 500;">npm -weight: 500;">install mongodb
import { MongoClient } from "mongodb"; const client = new MongoClient("mongodb+srv://user:[email protected]/mydb"); await client.connect();
const db = client.db("mydb"); // Insert
await db.collection("users").insertOne({ name: "Alex", email: "[email protected]", created: new Date()
}); // Find
const users = await db.collection("users").find({ name: "Alex" }).toArray();
console.log(users); // Aggregate
const stats = await db.collection("orders").aggregate([ { $group: { _id: "$-weight: 500;">status", count: { $sum: 1 }, total: { $sum: "$amount" } } }
]).toArray();
import { MongoClient } from "mongodb"; const client = new MongoClient("mongodb+srv://user:[email protected]/mydb"); await client.connect();
const db = client.db("mydb"); // Insert
await db.collection("users").insertOne({ name: "Alex", email: "[email protected]", created: new Date()
}); // Find
const users = await db.collection("users").find({ name: "Alex" }).toArray();
console.log(users); // Aggregate
const stats = await db.collection("orders").aggregate([ { $group: { _id: "$-weight: 500;">status", count: { $sum: 1 }, total: { $sum: "$amount" } } }
]).toArray();
import { MongoClient } from "mongodb"; const client = new MongoClient("mongodb+srv://user:[email protected]/mydb"); await client.connect();
const db = client.db("mydb"); // Insert
await db.collection("users").insertOne({ name: "Alex", email: "[email protected]", created: new Date()
}); // Find
const users = await db.collection("users").find({ name: "Alex" }).toArray();
console.log(users); // Aggregate
const stats = await db.collection("orders").aggregate([ { $group: { _id: "$-weight: 500;">status", count: { $sum: 1 }, total: { $sum: "$amount" } } }
]).toArray();
from pymongo import MongoClient client = MongoClient("mongodb+srv://user:[email protected]/mydb")
db = client["mydb"] # Insert
db.users.insert_one({"name": "Alex", "email": "[email protected]"}) # Find
users = list(db.users.find({"name": "Alex"})) # Full-text search (Atlas Search)
results = db.articles.aggregate([ {"$search": {"text": {"query": "web scraping", "path": "title"}}}, {"$limit": 10}
])
from pymongo import MongoClient client = MongoClient("mongodb+srv://user:[email protected]/mydb")
db = client["mydb"] # Insert
db.users.insert_one({"name": "Alex", "email": "[email protected]"}) # Find
users = list(db.users.find({"name": "Alex"})) # Full-text search (Atlas Search)
results = db.articles.aggregate([ {"$search": {"text": {"query": "web scraping", "path": "title"}}}, {"$limit": 10}
])
from pymongo import MongoClient client = MongoClient("mongodb+srv://user:[email protected]/mydb")
db = client["mydb"] # Insert
db.users.insert_one({"name": "Alex", "email": "[email protected]"}) # Find
users = list(db.users.find({"name": "Alex"})) # Full-text search (Atlas Search)
results = db.articles.aggregate([ {"$search": {"text": {"query": "web scraping", "path": "title"}}}, {"$limit": 10}
])
-weight: 500;">curl -X POST "https://data.mongodb-api.com/app/YOUR_APP/endpoint/data/v1/action/findOne" \ -H "Content-Type: application/json" \ -H "api-key: YOUR_API_KEY" \ -d '{ "dataSource": "Cluster0", "database": "mydb", "collection": "users", "filter": {"email": "[email protected]"} }'
-weight: 500;">curl -X POST "https://data.mongodb-api.com/app/YOUR_APP/endpoint/data/v1/action/findOne" \ -H "Content-Type: application/json" \ -H "api-key: YOUR_API_KEY" \ -d '{ "dataSource": "Cluster0", "database": "mydb", "collection": "users", "filter": {"email": "[email protected]"} }'
-weight: 500;">curl -X POST "https://data.mongodb-api.com/app/YOUR_APP/endpoint/data/v1/action/findOne" \ -H "Content-Type: application/json" \ -H "api-key: YOUR_API_KEY" \ -d '{ "dataSource": "Cluster0", "database": "mydb", "collection": "users", "filter": {"email": "[email protected]"} }'
// Create a search index in Atlas UI, then query:
const results = await db.collection("products").aggregate([ { $search: { index: "default", text: { query: "wireless headphones", path: ["name", "description"] } } }, { $limit: 10 }, { $project: { name: 1, price: 1, score: { $meta: "searchScore" } } }
]).toArray();
// Create a search index in Atlas UI, then query:
const results = await db.collection("products").aggregate([ { $search: { index: "default", text: { query: "wireless headphones", path: ["name", "description"] } } }, { $limit: 10 }, { $project: { name: 1, price: 1, score: { $meta: "searchScore" } } }
]).toArray();
// Create a search index in Atlas UI, then query:
const results = await db.collection("products").aggregate([ { $search: { index: "default", text: { query: "wireless headphones", path: ["name", "description"] } } }, { $limit: 10 }, { $project: { name: 1, price: 1, score: { $meta: "searchScore" } } }
]).toArray(); - 512 MB storage on a shared M0 cluster
- Full MongoDB API — CRUD, aggregation, indexes
- Atlas Search — full-text search powered by Lucene
- Charts — visual dashboards from your data
- Realm/Device Sync — mobile offline-first sync
- Data API — REST endpoints for your collections (no driver needed)
- 3 regions — AWS, GCP, or Azure
- Automatic backups — daily snapshots - 30+ Free APIs Every Developer Should Bookmark
- Auth0 Has a Free Tier
- Cloudinary Has a Free API
- OpenAI Has a Free API Tier
- Stripe Has a Free API
- Firebase Has a Free Tier
- Supabase Has a Free Tier
- NASA Has a Free API
- Twilio Has a Free Trial API
- Slack Has a Free API
- Mapbox Has a Free Tier
- Algolia Has a Free API
- PlanetScale Has a Free API
- Resend Has a Free API
- Upstash Has a Free API
- Neon Has a Free API