open-index/open-npm huggingface dataset:
npm package: @srart24/mongolocal
Description: mongolocal adalah modul database ringan berbasis JSON file untuk Node.js
Author: @srart24
Latest version: 1.0.0

# 📦 Mongolocal


---

> **mongolocal** adalah modul database ringan berbasis **JSON file** untuk Node.js.  
Menyediakan API mirip **Mongoose** dengan dukungan **Schema**, `connect`, `model`, dan query chainable.  
Bisa digunakan baik dengan **ESM (import)** maupun **CJS (require)**.

---


## NPM
[![Node.js Package](https://github.com/srart24/-srart24-mongolocal/actions/workflows/npm-publish.yml/badge.svg?branch=master&event=release)](https://github.com/srart24/-srart24-mongolocal/actions/workflows/npm-publish.yml)
<br>
[![npm version](https://badge.fury.io/js/@srart24/mongolocal.svg)](https://www.npmjs.com/package/@srart24/mongolocal)


## 🚀 Instalasi

```bash
npm install @srart24/mongolocal
```

```bash
yarn add @srart24/mongolocal
```

---

## 📦 import
``` js
const mongolocal = require('@srart24/mongolocal');

import mongolocal from '@srart24/mongolocal'
```

## ⚡ Pemakaian Dasar

```js

// set nama file database
mongolocal.connect('db.json');

// buat model User
const User = mongolocal.model('User', {
  name: String,
  age: Number,
  active: Boolean
});

// tambah user baru
User.create({ name: "Budi", age: 25, active: true });

// cari user
const result = User.find({ age: 25 });
console.log(result);

// update user
User.updateOne({ name: "Budi" }, { age: 26 });

// hapus user
User.deleteOne({ name: "Budi" });
```

---

## 📊 Tabel CRUD

| **Aksi**  | **Method**                     | **Contoh**                                         |
|-----------|--------------------------------|---------------------------------------------------|
| **Create** | `Model.create(data)`           | `User.create({ name: "Budi", age: 25 })`          |
| **Read**   | `Model.find(query?)`           | `User.find({ age: 25 })`                           |
|            | `Model.findOne(query)`         | `User.findOne({ name: "Budi" })`                   |
|            | `Model.findById(id)`           | `User.findById("abc123")`                          |
| **Update** | `Model.updateOne(query, data)` | `User.updateOne({ name: "Budi" }, { age: 26 })`   |
|            | `Model.updateMany(query, data)`| `User.updateMany({ active: true }, { active: false })` |
|            | `Model.updateById(id, data)`   | `User.updateById("abc123", { name: "Andi" })`     |
| **Delete** | `Model.deleteOne(query)`       | `User.deleteOne({ name: "Budi" })`                 |
|            | `Model.deleteMany(query)`      | `User.deleteMany({ active: false })`               |
|            | `Model.deleteById(id)`         | `User.deleteById("abc123")`                        |

---

## Lisensi

 [MIT LISENSI](LICENSE)


---



## Author

---

| <img src="https://github.com/srart24.png" width="70" height="70"> |
| :---: |
| [srart24](https://github.com/srart24) |

---