npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@memsdb/core

v2.1.0

Published

A simple embedded document based database with advanced querying, advanced population/tree creation, and multiple storage and backup providers.

Readme

memsdb

A simple in memory DB - Created to experiment more with typescript and classes

minified minified + gzip dependency count tree shaking Rate on Openbase

Documentation:

Initialising a new database:

import { DB } from '@memsdb/core'

const db = new DB('My DB Name')

Creating and assigning new collections to the db:

import { DBCollection } from '@memsdb/core'

const comments = new DBCollection(db, {
  name: 'comments',
  structure: {
    text: '',
    by: '',
    parent: '',
  },
})

Adding documents to an existing collection:

comments.insertOne({
  text: `My fantastic comment`,
  by: 'me'
})

Finding documents in a collection:

/**
 * Find all documents where the `by` field is equal to 'me'
 */
comments.find([{
  key: 'by',
  operation: '===',
  comparison: 'me'
}])
// Or with the QueryBuilder:
import { QueryBuilder } from '@memsdb/utils'

comments.find(QueryBuilder.where('by', '===', 'me'))

/**
 * Find a document by it's id
 */
comments.id('50d4047b-6c6d-47e8-b487-42ca2a7a4c00')

Full example:

import { DB, DBCollection } from '@memsdb/core'
import { QueryBuilder } from '@memsdb/utils'

const db = new DB('My DB Name')

const comments = new DBCollection(db, {
  name: 'comments',
  structure: {
    text: '',
    by: '',
    parent: '',
  },
})

comments.insertOne({
  text: `My fantastic comment`,
  by: 'me'
})

const docs = comments.find([{
  key: 'by',
  operation: '===',
  comparison: 'me'
}])
// Or with the QueryBuilder:
const docs = comments.find(QueryBuilder.where('by', '===', 'me'))

// docs should contain the one comment we added

The query language is still rather simple but can support the operators: < | > | <= | >= | === | || | includes | isContainedIn | hasAllOf | all>than | all<than | all>=to | all<=to | all===to | some>than | some<than | some>=to | some<=to | some===to - where || runs an OR using an array of Query objects (supports multi-level ORing). Additionally, you can use the length of an array as the "key" to compare values against. If you for example had the following document:

{
  "friends": [
    // ...
  ]
}

You would be able to query against the length of that array like so:

users.find(QueryBuilder.where('friends.length', '===', 0))

An example query object of:

const query = {
  key: 'by',
  operation: '===',
  comparison: 'me'
}
// Or with the QueryBuilder:
import { QueryBuilder } from '@memsdb/utils'

const query = QueryBuilder.where('by', '===', 'me')

should be read as document.data.by (key to get value of) '===' 'me' (value)

The some===to key (some*, all*) can be used to find similarities between different arrays

all===to makes sure that all of the specified key is equal to the comparison. This would usually be useful with query keys that specify an array with objects in it like the following: folder.children.[].exists. In the previous example you'd use all===to to make sure that all child folders of the first level have the property exists and that it's equal to whatever comparison value you set in the query. Eg.:

const query = {
  key: 'folder.children.[].exists',
  operation: 'all===to',
  comparison: true
}
// OR using the query builder:
import { QueryBuilder } from '@memsdb/utils'

const query = QueryBuilder
  .where('folder.children.[].exists', 'all===to', true)

Other functions on the database, collections, and documents can be read in the documentation