メインコンテンツまでスキップ
バージョン: 🚧 Canary

🗄️ Mongo Blocks

MongoDB blocks provide core database operations and utility functions for MongoDB collections in Nodeblocks applications. These blocks encapsulate common MongoDB patterns with standardized error handling and data normalization.


🎯 Overview

MongoDB blocks are designed to:

  • Provide database query operations with standardized functions for finding documents
  • Handle errors consistently with custom BlockError classes
  • Normalize data automatically by handling MongoDB-specific fields like _id
  • Ensure type safety with full TypeScript support
  • Enable composition for building complex database operations

📦 Block Types

🔧 Blocks

Pure business logic functions for MongoDB operations:

  • findResources: Retrieves multiple documents from MongoDB collection with error handling and field projection, returning an array of documents or an appropriate error
  • buildWithoutMongoIdFindOptions: Builds MongoDB find options to exclude the _id field from query results, ensuring clean API responses

View Mongo Blocks →