{"id":25600,"library":"follicle","title":"Follicle","description":"Follicle is a class-based ES6 ODM (Object Document Mapper) for MongoDB and NeDB, forked from camo to support multiple concurrent database connections. Current version is 3.1.0 (stable, requires Node >=12). It provides a familiar OOP interface with ES6 classes, native Promises, and support for embedded documents, hooks, and counting. Unlike Mongoose, it offers a lighter-weight approach and supports NeDB as an alternative backend for development or in-memory usage. Release cadence is irregular; maintained by Seald.","status":"active","version":"3.1.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","es6","odm","mongodb","nedb","nosql","document","model","schema"],"install":[{"cmd":"npm install follicle","lang":"bash","label":"npm"},{"cmd":"yarn add follicle","lang":"bash","label":"yarn"},{"cmd":"pnpm add follicle","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Optional NeDB backend for development or in-memory storage","package":"@seald-io/nedb","optional":true},{"reason":"Optional MongoDB backend for production","package":"mongodb","optional":true}],"imports":[{"note":"ESM-only; CommonJS require is not supported for named exports.","wrong":"const connect = require('follicle').connect","symbol":"connect","correct":"import { connect } from 'follicle'"},{"note":"ESM-only; Document is a named export.","wrong":"const { Document } = require('follicle')","symbol":"Document","correct":"import { Document } from 'follicle'"},{"note":"Named export for defining embedded schemas.","wrong":"","symbol":"EmbeddedDocument","correct":"import { EmbeddedDocument } from 'follicle'"}],"quickstart":{"code":"import { connect, Document } from 'follicle';\n\n(async () => {\n  const database = await connect('mongodb://localhost:27017/mydb');\n\n  class User extends Document {\n    constructor() {\n      super();\n      this.name = '';\n      this.email = '';\n      this.age = 0;\n    }\n  }\n\n  const user = User.create({\n    name: 'Jane Doe',\n    email: 'jane@example.com',\n    age: 30\n  });\n  await user.save();\n\n  const users = await User.find({ age: { $gte: 18 } });\n  console.log(users);\n\n  await database.close();\n})().catch(console.error);","lang":"typescript","description":"Shows connecting to MongoDB, defining a document class, creating and saving a document, and querying with a filter."},"warnings":[{"fix":"Use import statements and set type: 'module' in package.json, or use dynamic import().","message":"The package is ESM-only since v3.0.0. Importing with require() will fail.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Run 'npm install @seald-io/nedb' for development or 'npm install mongodb' for production.","message":"You must install at least one backend driver (@seald-io/nedb or mongodb) or require it at runtime. Follicle will throw if no backend is available.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Migrate to MongoDB for production workloads.","message":"Using `connect()` with NeDB may have connection pool limitations compared to MongoDB; NeDB support is considered legacy.","severity":"deprecated","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'npm install follicle --save' and ensure 'type': 'module' in package.json if using ESM.","cause":"Follicle is not installed or not resolved due to ESM configuration.","error":"Error: Cannot find module 'follicle'"},{"fix":"Replace require() with import { connect } from 'follicle'.","cause":"Using require() on an ESM-only export.","error":"TypeError: connect is not a function"},{"fix":"Install npm install @seald-io/nedb (for development) or npm install mongodb (for production).","cause":"Missing backend dependency.","error":"Error: No database backend found. Please install @seald-io/nedb or mongodb."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}