You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/apps/session-storage/shopify-app-session-storage-mongodb/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,4 +27,4 @@ const shopify = shopifyApp({
27
27
});
28
28
```
29
29
30
-
If you prefer to use your own implementation of a session storage mechanism that is compatible with the `@shopify/shopify-app-express` package, see the [implementing session storage guide](../shopify-app-session-storage/implementing-session-storage.md).
30
+
If you prefer to use your own implementation of a session storage mechanism that uses the `SessionStorage` interface, see the [implementing session storage guide](../shopify-app-session-storage/implementing-session-storage.md).
Copy file name to clipboardExpand all lines: packages/apps/session-storage/shopify-app-session-storage-prisma/README.md
+34-2Lines changed: 34 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -103,6 +103,38 @@ Here are some possible solutions for this issue:
103
103
1. Ensure you've copied the schema above into your `prisma.schema` file.
104
104
1. If you've made changes to the table, make sure it's still called `Session`.
105
105
106
-
### Error: The "mongodb" provider is not supported with this command
106
+
### MongoDB
107
107
108
-
MongoDB does not support the [prisma migrate](https://www.prisma.io/docs/orm/prisma-migrate/understanding-prisma-migrate/overview) command. If you are using MongoDB please see the [Prisma documentation](https://www.prisma.io/docs/orm/overview/databases/mongodb) for configuring your database.
108
+
If you choose to use MongoDB with prisma, MongoDB support in Prisma has some gotchas that you should be aware of.
109
+
110
+
Alternatively you can use a MongoDB database directly with the [MongoDB session storage adapter](https://www.npmjs.com/package/@shopify/shopify-app-session-storage-mongodb).
111
+
112
+
#### Mapping the id field
113
+
114
+
In MongoDB, an ID must be a single field that defines an `@id` attribute and a `@map("\_id")` attribute. The prisma adapter expects the ID field to be the ID of the session, and not the \_id field of the document.
115
+
116
+
You'll need to make some modifications to the schema and prisma configuration. For more information please see the [Prisma MongoDB documentation](https://www.prisma.io/docs/orm/overview/databases/mongodb).
117
+
118
+
To make this work add a new field to the schema that maps the \_id field to the id field. For more information see the [Prisma documentation](https://www.prisma.io/docs/orm/prisma-schema/data-model/models#defining-an-id-field)
#### Error: The "mongodb" provider is not supported with this command
129
+
130
+
MongoDB does not support the [prisma migrate](https://www.prisma.io/docs/orm/prisma-migrate/understanding-prisma-migrate/overview) command. Instead, you can use the [prisma db push](https://www.prisma.io/docs/orm/reference/prisma-cli-reference#db-push) command and update the `shopify.web.toml` file with the following commands. If you are using MongoDB please see the [Prisma documentation](https://www.prisma.io/docs/orm/overview/databases/mongodb) for more information.
131
+
132
+
```toml
133
+
[commands]
134
+
predev = "npx prisma generate && npx prisma db push"
#### Prisma needs to perform transactions, which requires your mongodb server to be run as a replica set
139
+
140
+
See the [Prisma documentation](https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch/mongodb/connect-your-database-node-mongodb) for connecting to a MongoDB database.
0 commit comments