Mongodb DB

Connecting, querying, updating, and aggregating document-based records in MongoDB.

Lord1Egypt Updated 2 repo stars

File contents

Mongodb Db

Overview

MongoDB is a source-available cross-platform document-oriented database program classified as a NoSQL database.

When to Use This Skill

Use when storing unstructured or dynamic JSON-like records that require complex nested schemas.

Quick Start (with runnable code examples)

from pymongo import MongoClient

# Connect to MongoDB
client = MongoClient("mongodb://localhost:27017/")
db = client.test_database
collection = db.test_collection

# Insert and find
post_id = collection.insert_one({"author": "Lord1Egypt", "text": "Post text"}).inserted_id
print("Inserted ID:", post_id)
print(collection.find_one({"author": "Lord1Egypt"}))

Advanced Usage

Execute aggregation pipelines, manage document indexing, and handle connection pool timeouts.

Key References

Dependencies

  • pymongo>=4.0.0

Lord1Egypt/ai-skillforge/tree/main/js/skills/gemini/mongodb-db commit 8c3f68fede

Frequently asked questions

npx skillmds@latest add lord1egypt/mongodb-db-2