MingoDb is a playful, MongoDB-inspired, client-side library that brings a MongoDB-like experience right into your JavaScript environment. Designed for educational purposes and fun experiments, MingoDb uses the power of the 'mingo' library to let you manage a "database" without any server-side processes. Perfect for learning database operations or adding a database feel to your prototypes!
MingoDb is intended for fun and learning. It is not built for production environments. So, dive in for experimentation, but keep it out of your production code!
- Simple and intuitive API similar to MongoDB
- Lightweight client-side database operations
- Fun and easy to understand, perfect for demos and learning
Currently, MingoDb is a conceptual project and not published on npm. To use it, you might consider cloning a repo (when available) and using it directly from there.
Hereβs how you can create a new database and start interacting with it:
- Create a Database Instance: Initialize your MingoDb with a unique session or user identifier.
- Create a Collection: Think of collections like tables in a relational database. Here, you can store your documents.
- Performing Operations: Insert, update, find, or delete documents in a straightforward manner.
/// Initialize your database
const db = new MingoDb("my-session-id");
// Create a collection
const users = db.collection("users");
// Insert a new user
const newUser = await users.insert({
name: "Alice",
age: 25,
hobbies: ["reading", "gaming"]
});
// Find a user
const foundUser = await users.find({ name: "Alice" });
// Update a user
await users.update({ name: "Alice" }, { $set: { age: 26 } });
// Remove a user
await users.remove({ name: "Alice" });
Set up listeners to react to changes in your collections. Useful for debugging or understanding how data flows through your app.
users.onChange({
query: {},
callback: (docs, type) => {
console.log(`${type} operation performed`, docs);
},
changeType: ["insert", "update", "remove"],
immediate: true
});
Contributions are what make the open-source community such a fantastic place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
To ensure that your contributions and updates do not break any existing functionality, we encourage you to write and run tests frequently.
`npm run test`
Make sure your features are well-covered!
If youβre interested in using, improving, or just playing around with MingoDb, feel free to get involved. Check out the issues tab for things to start working on. Remember, no contribution is too small and every contribution is valued.