{"id":16584,"library":"whocallsthefleet-database","title":"Who Calls the Fleet Database","description":"The `whocallsthefleet-database` package provides a dataset specifically structured as an embedded NeDB database for the 'Who Calls the Fleet' project (https://fleet.moe), which focuses on Kantai Collection game data. NeDB is a lightweight, embedded document-oriented database written in JavaScript, offering a subset of MongoDB's API for querying. It is designed for small-scale applications, capable of operating in-memory or persisting data to a local file. The current version of this data package is `20240308.0.1`. The original NeDB project by louischatriot is considered abandoned, with development ceasing around 2017, although forks like `@seald-io/nedb` continue active maintenance and introduce modern JavaScript features like Promises. This package's primary differentiator is its specific dataset content for 'Who Calls the Fleet', using NeDB for local, file-based storage without requiring a separate database server. It is ideal for desktop applications (Electron, nw.js) or small Node.js services requiring a local, non-concurrent data store.","status":"abandoned","version":"20240308.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/Diablohu/WhoCallsTheFleet-DB","tags":["javascript"],"install":[{"cmd":"npm install whocallsthefleet-database","lang":"bash","label":"npm"},{"cmd":"yarn add whocallsthefleet-database","lang":"bash","label":"yarn"},{"cmd":"pnpm add whocallsthefleet-database","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime dependency for interacting with the database files. The `whocallsthefleet-database` package provides the data, and `nedb` provides the database engine. Consider using `@seald-io/nedb` for active maintenance.","package":"nedb","optional":false},{"reason":"Recommended actively maintained fork of NeDB, providing modern features and bug fixes. Can be used as a drop-in replacement for the original `nedb` package.","package":"@seald-io/nedb","optional":true}],"imports":[{"note":"The `whocallsthefleet-database` package itself does not export symbols for direct database interaction; it provides the data files. You must import `Datastore` from `nedb` (or its maintained fork `@seald-io/nedb`) to interact with the database files provided by this package. ESM syntax is preferred in modern Node.js, while CommonJS `require` is also supported.","wrong":"const Datastore = require('nedb');","symbol":"Datastore","correct":"import Datastore from 'nedb'; // or '@seald-io/nedb'"},{"note":"To load the data from `whocallsthefleet-database`, you instantiate a `Datastore` from `nedb` (or `@seald-io/nedb`) and point its `filename` option to the actual data file within the installed `whocallsthefleet-database` package. The exact path might vary slightly based on your project structure and OS.","wrong":"import { db } from 'whocallsthefleet-database';","symbol":"Datastore (with path)","correct":"import Datastore from '@seald-io/nedb';\nconst db = new Datastore({ filename: './node_modules/whocallsthefleet-database/db.json', autoload: true });"},{"note":"While the original `nedb` primarily uses callback-based APIs, the `@seald-io/nedb` fork provides a modern Promise-based (async/await compatible) API for all operations, which is the recommended approach for new development.","wrong":"db.loadDatabase(() => { /* callback style */ });","symbol":"Promise API","correct":"import Datastore from '@seald-io/nedb';\nconst db = new Datastore({ filename: './node_modules/whocallsthefleet-database/db.json' });\nawait db.loadDatabaseAsync(); // Using the async/Promise API from @seald-io/nedb"}],"quickstart":{"code":"import Datastore from '@seald-io/nedb'; // Use @seald-io/nedb for modern Promise API\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\n// Determine the path to the database file provided by whocallsthefleet-database\n// This path assumes 'whocallsthefleet-database' is installed in node_modules\nconst dbPath = path.join(__dirname, 'node_modules', 'whocallsthefleet-database', 'db.json');\n\nasync function loadAndQueryData() {\n  try {\n    // Initialize a new Datastore instance, pointing to the data file\n    const db = new Datastore({\n      filename: dbPath,\n      autoload: true // Automatically load the database on creation\n    });\n\n    // Wait for the database to be loaded (autoload handles this implicitly, but explicit wait is good practice for persistence setup)\n    // If not using autoload, you would call await db.loadDatabaseAsync();\n\n    console.log('Database loaded from:', dbPath);\n\n    // Example: Find all documents in the database\n    const allDocs = await db.findAsync({});\n    console.log(`Found ${allDocs.length} documents.`);\n\n    // Example: Find documents matching a specific criteria (e.g., a 'name' field, assuming data structure)\n    // Note: The actual fields depend on the 'Who Calls the Fleet' data schema.\n    // This is a placeholder example.\n    const exampleDoc = await db.findOneAsync({ 'id': 'some_kancolle_id' }); // Replace with actual query\n    if (exampleDoc) {\n      console.log('Example document found:', exampleDoc);\n    } else {\n      console.log('No document found with example ID.');\n    }\n\n    // You can also count documents\n    const count = await db.countAsync({});\n    console.log(`Total documents (counted): ${count}`);\n\n  } catch (error) {\n    console.error('Error interacting with the database:', error);\n  }\n}\n\nloadAndQueryData();","lang":"typescript","description":"This quickstart demonstrates how to load the `whocallsthefleet-database` data files using `@seald-io/nedb` and perform basic query operations. It initializes a `Datastore` instance, loads the data automatically, and then fetches and logs documents."},"warnings":[{"fix":"Users should be aware that future compatibility issues or bugs related to the package's structure might not be addressed. Consider extracting the underlying JSON data for custom processing if long-term stability or active development is crucial.","message":"The GitHub repository for `whocallsthefleet-database` (TeamFleet/WhoCallsTheFleet-DB) was archived by the owner on December 20, 2024, and is now read-only. This indicates that the package providing this dataset is no longer actively maintained or developed. While data updates might still occur, the distribution method via this package or its source code will not receive further changes or bug fixes.","severity":"breaking","affected_versions":">=20240308.0.1"},{"fix":"Install `@seald-io/nedb` instead of `nedb` and update your import statements: `import Datastore from '@seald-io/nedb';`.","message":"The underlying NeDB project (louischatriot/nedb) is considered abandoned, with no new features or active maintenance since 2017. While it remains functional for basic use cases, users are strongly encouraged to use actively maintained forks like `@seald-io/nedb` for better stability, modern API features (Promises), and ongoing bug fixes.","severity":"gotcha","affected_versions":"*"},{"fix":"For concurrent access, multi-user applications, or large datasets, consider migrating to a dedicated database solution like MongoDB (due to API similarity) or PostgreSQL. For single-process, local data storage, ensure only one instance accesses the database file at a time.","message":"NeDB is an embedded database designed for small datasets and primarily operates in-memory for performance. While it supports persistence to a file, it does not offer robust concurrency control or support for multi-process environments. Each process will have its own copy of the database, making data synchronization complex and prone to issues.","severity":"gotcha","affected_versions":"*"},{"fix":"If file size becomes a concern, especially after numerous updates/deletes, ensure your application reloads the database periodically or explicitly calls `db.persistence.compactDatafile()` (or `db.compactDatafileAsync()` in `@seald-io/nedb`) to compact the data file. Note that manual compaction requires pausing other operations.","message":"NeDB uses an append-only file format for persistence, which can lead to larger file sizes over time. Automatic compaction occurs upon database loading, but manual compaction might be necessary for specific performance or storage requirements.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Ensure the `filename` option points to a valid path for the NeDB data file (e.g., `path.join(__dirname, 'node_modules', 'whocallsthefleet-database', 'db.json')`) and that `autoload: true` is set, or explicitly call and `await db.loadDatabaseAsync()` before performing any operations.","cause":"The `Datastore` instance was not properly initialized or the database failed to load, leading to methods like `find` or `findOne` being called on an undefined object. This often happens if `autoload` is false and `loadDatabaseAsync()` wasn't called or awaited, or if the `filename` path is incorrect.","error":"TypeError: Cannot read properties of undefined (reading 'find')"},{"fix":"Avoid calling `loadDatabaseAsync()` multiple times. If `autoload: true` is used in the constructor, the database loads once, and subsequent calls are unnecessary. For programmatic control, initialize the `Datastore` once and then use its methods without re-loading.","cause":"Attempting to call `loadDatabaseAsync()` or rely on `autoload: true` on a `Datastore` instance that has already loaded its data.","error":"Error: Could not load database, it was already loaded."},{"fix":"Before inserting, check if a document with the conflicting unique field value already exists. Alternatively, handle the error gracefully or remove the unique constraint if it's not strictly required for your data model. Ensure your `ensureIndexAsync` calls correctly define unique constraints.","cause":"Attempting to insert a document with a value for an indexed field that has a unique constraint, where that value already exists in another document.","error":"Error: unique constraint violated"}],"ecosystem":"npm"}