New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

clancydb

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clancydb

ClancyDB is a lightweight, file-based NoSQL database inspired by MongoDB. It provides an easy-to-use API for storing, querying, and managing JSON-based data.

latest
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

ClancyDB - Lightweight JSON Database

ClancyDB is a lightweight, file-based NoSQL database inspired by MongoDB. It provides an easy-to-use API for storing, querying, and managing JSON-based data.

Features

Lightweight & File-Based – Stores data efficiently in JSON format.
Collections & Models – Organize and structure your data easily.
Schema Validation – Built-in validation with Joi for data integrity.
Aggregation Pipeline – Supports MongoDB-like query operators.
Indexing – Optimize queries with basic indexing support.
Simple API – Designed for ease of use with a clean syntax.

Installation

Install ClancyDB using npm:

npm install clancydb

Quick Start

Initialize Database

const ClancyDB = require('clancydb');
const db = new ClancyDB('data.json');

Define a Model

const User = db.model('users', {
    name: { type: 'string', required: true },
    age: { type: 'number', required: true }
});

Insert Data

User.insert({ name: 'Alice', age: 25 });

Query Data

const users = User.find({ age: { $gte: 18 } });
console.log(users.data);

Update Data

const user = User.find({ name: 'Alice' });
user.update({ age: 26 });

Delete Data

User.delete({ age: { $lt: 18 } });

Aggregation Example

Perform advanced queries using aggregation operators:

const results = User.aggregate([
    { $match: { age: { $gte: 18 } } },
    { $group: { _id: null, averageAge: { $avg: 'age' } } }
]);
console.log(results);

Supported Aggregation Operators

  • $match – Filter documents based on conditions.
  • $group – Group data and perform calculations.
  • $sort – Sort documents by field values.
  • $limit – Restrict the number of results.
  • $skip – Skip a specified number of documents.
  • $project – Select specific fields.
  • $unwind – Expand array fields into separate documents.
  • $lookup – Perform joins with other collections.
  • $count – Count the number of matching documents.

License

IDK, it's open-source.

More Details

For more details, visit the GitHub repository.

Keywords

database

FAQs

Package last updated on 25 Mar 2025

Did you know?

Socket

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.

Install

Related posts