docs: document JSON properties (#13099)
This commit is contained in:
1 parent
1c1e1c6aa2
commit
54a74b0215
14 files changed
+1072
-17
No files matched your search
@@ -135,3 +135,37 @@ Learn more about accepted filters in [this documentation](../../tips/filtering/p
|
||||
### Returns
|
||||
|
||||
The method returns an array of objects of updated records.
|
||||
|
||||
---
|
||||
|
||||
## Update a JSON Property
|
||||
|
||||
```ts
|
||||
const post = await postModuleService.updatePosts({
|
||||
id: "123",
|
||||
name: "My Post",
|
||||
metadata: {
|
||||
category: "news",
|
||||
tags: ["update", "json"],
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
When you have a JSON property in your data model, you can update it by adding, updating, or removing properties within that JSON object. Medusa will merge the properties you pass in the `update` method with the existing JSON object.
|
||||
|
||||
### Remove a Property from the JSON Property
|
||||
|
||||
```ts
|
||||
const post = await postModuleService.updatePosts({
|
||||
id: "123",
|
||||
metadata: {
|
||||
is_featured: "",
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
To remove a property from the JSON object, you can set its value to an empty string.
|
||||
|
||||
### Learn More about Updating JSON Properties
|
||||
|
||||
Refer to the [JSON Properties](!docs!/learn/fundamentals/data-models/json-properties) documentation to learn more about how JSON properties work in Medusa and how to update them.
|
||||
@@ -131,7 +131,7 @@ export const generatedEditDates = {
|
||||
"app/service-factory-reference/methods/restore/page.mdx": "2024-07-31T17:01:33+03:00",
|
||||
"app/service-factory-reference/methods/retrieve/page.mdx": "2024-07-31T17:01:33+03:00",
|
||||
"app/service-factory-reference/methods/soft-delete/page.mdx": "2024-07-31T17:01:33+03:00",
|
||||
"app/service-factory-reference/methods/update/page.mdx": "2024-07-31T17:01:33+03:00",
|
||||
"app/service-factory-reference/methods/update/page.mdx": "2025-07-31T08:24:03.685Z",
|
||||
"app/service-factory-reference/tips/filtering/page.mdx": "2025-04-23T14:38:29.068Z",
|
||||
"app/service-factory-reference/page.mdx": "2024-07-26T14:40:56+00:00",
|
||||
"app/storefront-development/cart/context/page.mdx": "2025-03-27T14:47:14.258Z",
|
||||
|
||||
@@ -6102,6 +6102,14 @@ const generatedgeneratedCommerceModulesSidebarSidebar = {
|
||||
"path": "https://docs.medusajs.com/resources/how-to-tutorials/tutorials/gift-message",
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"loaded": true,
|
||||
"isPathHref": true,
|
||||
"type": "ref",
|
||||
"title": "Generate Invoices",
|
||||
"path": "https://docs.medusajs.com/resources/how-to-tutorials/tutorials/invoice-generator",
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"loaded": true,
|
||||
"isPathHref": true,
|
||||
|
||||
@@ -819,6 +819,14 @@ const generatedgeneratedToolsSidebarSidebar = {
|
||||
"path": "https://docs.medusajs.com/resources/how-to-tutorials/tutorials/first-purchase-discounts",
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"loaded": true,
|
||||
"isPathHref": true,
|
||||
"type": "ref",
|
||||
"title": "Generate Invoices",
|
||||
"path": "https://docs.medusajs.com/resources/how-to-tutorials/tutorials/invoice-generator",
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"loaded": true,
|
||||
"isPathHref": true,
|
||||
|
||||
Reference in new issue
Block a user