Skip to main content
The MongoDB package in Orionjs provides a powerful abstraction layer over the native MongoDB driver, optimized for TypeScript and seamlessly integrated with Orionjs’s repository pattern.

Overview

Working directly with the MongoDB driver can be verbose and lacks type safety. The Orionjs MongoDB package addresses these challenges by providing:
  • Type-safe MongoDB operations
  • Seamless integration with Orionjs schemas
  • Automatic validation before database operations

Integration with Repositories

MongoDB collections are typically used within repository classes, following Orionjs’s architecture:

Key Features

Type Safety

Collections are strongly typed based on your schema definitions:

Automatic Validation

Documents are automatically validated against your schema before being inserted or updated:

Next Steps

In the following sections, we’ll explore how to: