docs: docs for next release (#13621)
* docs: docs for next release * changes to opentelemetry dependencies * document plugin env variables * document admin changes * fix vale error * add version notes * document campaign budget updates * document campaign changes in user guide * document chages in cluster mode cli * documented once promotion allocation * document multiple API keys support
This commit is contained in:
@@ -152,6 +152,12 @@ Consider your have a MongoDB module that allows you to perform operations on a M
|
||||
|
||||
To connect to the database, you create the following loader in your module:
|
||||
|
||||
<Note>
|
||||
|
||||
As of [Medusa v2.11.0](https://github.com/medusajs/medusa/releases/tag/v2.11.0), Awilix dependencies are included in the `@medusajs/framework` package. If you're using an older version of Medusa, change the import statement to `awilix`.
|
||||
|
||||
</Note>
|
||||
|
||||
export const loaderHighlights = [
|
||||
["5", "ModuleOptions", "Define a type for expected options."],
|
||||
["13", "ModuleOptions", "Pass the option type as a type argument to `LoaderOptions`."],
|
||||
@@ -163,7 +169,7 @@ export const loaderHighlights = [
|
||||
|
||||
```ts title="src/modules/mongo/loaders/connection.ts" highlights={loaderHighlights}
|
||||
import { LoaderOptions } from "@medusajs/framework/types"
|
||||
import { asValue } from "awilix"
|
||||
import { asValue } from "@medusajs/framework/awilix"
|
||||
import { MongoClient } from "mongodb"
|
||||
|
||||
type ModuleOptions = {
|
||||
@@ -233,7 +239,7 @@ In the loader, you check first that these options are set before proceeding. The
|
||||
After creating the client, you register it in the module's container using the container's `register` method. The method accepts two parameters:
|
||||
|
||||
1. The key to register the resource under, which in this case is `mongoClient`. You'll use this name later to resolve the client.
|
||||
2. The resource to register in the container, which is the MongoDB client you created. However, you don't pass the resource as-is. Instead, you need to use an `asValue` function imported from the [awilix package](https://github.com/jeffijoe/awilix), which is the package used to implement the container functionality in Medusa.
|
||||
2. The resource to register in the container, which is the MongoDB client you created. However, you don't pass the resource as-is. Instead, you need to use an `asValue` function imported from the [`@medusajs/framework/awilix` package](https://github.com/jeffijoe/awilix), which is the package used to implement the container functionality in Medusa.
|
||||
|
||||
### Use Custom Registered Resource in Module's Service
|
||||
|
||||
|
||||
Reference in New Issue
Block a user