@robinpath/mongo
0.1.1PublicMongoDB client with find, insert, update, delete, aggregation pipeline, indexing, and connection management
@robinpath/mongo
MongoDB client with find, insert, update, delete, aggregation pipeline, indexing, and connection management
Why use this module?
The mongo module lets you:
- Find documents
- Find one document
- Insert one document
- Insert multiple documents
- Update one document
All functions are callable directly from RobinPath scripts with a simple, consistent API.
Installation
npm install @robinpath/mongo
Quick Start
1. Set up credentials
mongo.connect {"uri": "mongodb://localhost:27017", "database": "mydb"}
2. Find documents
mongo.find "users" {"age": {"$gt": 18}} {"limit": 10}
Available Functions
| Function | Description |
|---|---|
mongo.connect | Connect to MongoDB |
mongo.find | Find documents |
mongo.findOne | Find one document |
mongo.insertOne | Insert one document |
mongo.insertMany | Insert multiple documents |
mongo.updateOne | Update one document |
mongo.updateMany | Update many documents |
mongo.deleteOne | Delete one document |
mongo.deleteMany | Delete many documents |
mongo.aggregate | Run aggregation pipeline |
mongo.count | Count documents |
mongo.distinct | Get distinct values |
mongo.collections | List collections |
mongo.createIndex | Create index |
mongo.objectId | Generate or parse ObjectId |
mongo.close | Close connection |
mongo.closeAll | Close all connections |
Examples
Find documents
mongo.find "users" {"age": {"$gt": 18}} {"limit": 10}
Find one document
mongo.findOne "users" {"email": "alice@example.com"}
Insert one document
mongo.insertOne "users" {"name": "Alice", "age": 30}
Integration with RobinPath
import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/mongo";
const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);
const result = await rp.executeScript(`
mongo.connect {"uri": "mongodb://localhost:27017", "database": "mydb"}
mongo.find "users" {"age": {"$gt": 18}} {"limit": 10}
`);
Full API Reference
See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.
Related Modules
@robinpath/mysql— MySQL module for complementary functionality@robinpath/postgres— PostgreSQL module for complementary functionality@robinpath/redis— Redis module for complementary functionality@robinpath/supabase— Supabase module for complementary functionality@robinpath/firebase— Firebase module for complementary functionality
License
MIT
Versions (1)
| Version | Tag | Published |
|---|---|---|
| 0.1.1 | latest | yesterday |
Related Modules
@robinpath/chart
Generate chart images (PNG/JPEG) using Chart.js. Supports bar, line, pie, doughnut, scatter, radar, polarArea, and bubble charts with auto-coloring and customizable titles, legends, and dimensions.
@robinpath/firebase
Firebase module for RobinPath.
@robinpath/graph
Graph data structures with BFS, DFS, Dijkstra's shortest path, topological sort, cycle detection, and connectivity
@robinpath/hotjar
Hotjar module for RobinPath.
$ robinpath install @robinpath/mongo
