![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
easy-mongo-orm
Advanced tools
A powerful and elegant MongoDB/Mongoose toolkit that makes database operations a breeze with built-in caching, search, pagination, performance monitoring, and more
A powerful and elegant MongoDB/Mongoose toolkit that makes database operations a breeze with built-in caching, search, pagination, performance monitoring, and more.
npm install easy-mongo-orm mongoose
const { EasyMongo } = require('easy-mongo-orm');
// Initialize with your model configuration
const userDb = new EasyMongo({
connection: {
uri: 'mongodb://localhost:27017/mydb'
},
model: {
name: 'User',
schema: {
name: { type: String, required: true },
email: { type: String, required: true, unique: true },
age: Number,
tags: [String]
},
options: {
timestamps: true
}
},
features: {
enableCache: true,
enablePerformanceMonitoring: true
}
});
// Connect to database
await userDb.connect();
// CRUD Operations
const user = await userDb.create({
name: 'John Doe',
email: 'john@example.com',
age: 30,
tags: ['developer']
});
// Search Operations
const results = await userDb.search({
text: 'John',
fields: ['name']
});
// Pagination
const { data, pagination } = await userDb.paginate(
{ age: { $gt: 25 } },
{ page: 1, limit: 10 }
);
// Performance Stats
const stats = userDb.getPerformanceStats();
const results = await userDb.search({
text: 'developer',
fields: ['tags', 'bio']
});
const nearbyUsers = await userDb.searchNearby({
coordinates: [-73.935242, 40.730610],
maxDistance: 1000 // meters
});
const results = await userDb.fuzzySearch({
field: 'name',
query: 'jhon' // will match "John"
});
const users = await userDb
.query()
.where({ age: { $gt: 25 } })
.select('name email')
.sort('-createdAt')
.limit(10)
.execute();
const stream = userDb
.largeDataset()
.where({ status: 'active' })
.stream();
for await (const doc of stream) {
// Process each document
}
await userDb.withTransaction(async (session) => {
const user = await userDb.create({
name: 'Alice',
email: 'alice@example.com'
}, { session });
await userDb.create({
name: 'Bob',
email: 'bob@example.com'
}, { session });
});
// First call hits database
const user1 = await userDb.findOne({ email: 'john@example.com' });
// Second call uses cache
const user2 = await userDb.findOne({ email: 'john@example.com' });
// Clear specific cache
await userDb.clearCache('email:john@example.com');
// Clear all cache
await userDb.clearAllCache();
const stats = userDb.getPerformanceStats();
console.log(stats);
// {
// operations: {
// create: { count: 10, totalTime: 150, averageTime: 15 },
// find: { count: 20, totalTime: 180, averageTime: 9 }
// },
// totalQueries: 30,
// averageQueryTime: 11,
// errors: 0
// }
{
uri: 'mongodb://localhost:27017/mydb',
options: {
useNewUrlParser: true,
useUnifiedTopology: true
// ... other mongoose connection options
}
}
{
enableCache: true,
cacheTTL: 3600, // seconds
enablePerformanceMonitoring: true,
enableRateLimit: true,
rateLimit: {
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100 // requests per windowMs
}
}
Contributions are welcome! Please feel free to submit a Pull Request.
MIT © Md.Tousif
FAQs
A powerful and elegant MongoDB/Mongoose toolkit that makes database operations a breeze with built-in caching, search, pagination, performance monitoring, and more
The npm package easy-mongo-orm receives a total of 159 weekly downloads. As such, easy-mongo-orm popularity was classified as not popular.
We found that easy-mongo-orm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.