Skip to content

Commit 602bb7f

Browse files
committed
Remove outdated part about schema
1 parent 9824645 commit 602bb7f

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

usage/tools/cloudcode.mdx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -184,29 +184,27 @@ The body of the request payload should look like this:
184184
}
185185
```
186186

187-
The `op` refers to the type of operation recorded by the PowerSync client SDK (`PUT`, `PATCH` or `DELETE`). Refer to [Writing Client Changes](/installation/app-backend-setup/writing-client-changes) for details.
187+
* `batch` should be an array of operations from the PowerSync client SDK.
188+
* `op` refers to the type of each operation recorded by the PowerSync client SDK (`PUT`, `PATCH` or `DELETE`). Refer to [Writing Client Changes](/installation/app-backend-setup/writing-client-changes) for details.
188189

189190
The API will respond with HTTP status `200` if the write was successful.
190191

191192

192-
## Customization required
193+
## Customization
193194

194-
You can make changes to the way the `upload` task writes data to the source MongoDB database. At a minimum, at this time you will need to modify it to take your specific MongoDB database "schema" into consideration (Note: We are working on updating the template to not require adapting it to your schema. We will update this documentation page accordingly once that change is shipped).
195+
You can make changes to the way the `upload` task writes data to the source MongoDB database.
195196

196197
Here is how:
197198

198-
1. Open the **CloudCode** section at the top of the IDE.
199+
1. Go to **CloudCode** at the top of the IDE in your JourneyApps Platform project
199200
2. Select and expand the `upload` task in the panel on the left.
200-
3. The `index.ts` contains the entry point function that accepts the HTTP request and has a `MongoDBStorage` class which interacts with the MongoDB database to perform inserts, updates and deletes. To adjust how updates are performed take a look at the `updateBatch` function.
201+
3. The `index.ts` contains the entry point function that accepts the HTTP request and has a `MongoDBStorage` class which interacts with the MongoDB database to perform inserts, updates and deletes. To adjust how updates are performed, take a look at the `updateBatch` function.
201202

202203
## Production considerations
203204

204205
Before going into production with this solution, you will need to set up authentication on the HTTP endpoints exposed by the CloudCode tasks.
205206

206-
If you need more data validations and/or authorization than what is provided by the template, that will need to be customized too.
207+
If you need more data validations and/or authorization than what is provided by the template, that will need to be customized too. Consider introducing schema validation of the data being written to the source MongoDB database. You should use a [purpose-built](https://json-schema.org/tools?query=&sortBy=name&sortOrder=ascending&groupBy=toolingTypes&licenses=&languages=&drafts=&toolingTypes=&environments=&showObsolete=false) library for this, and use [MongoDB Schema Validation](https://www.mongodb.com/docs/manual/core/schema-validation/) to enforce the types in the database.
207208

208-
For production applications you would also want to consider introducing schema validation of the data being written to the source MongoDB database.
209-
You should use a [purpose-built](https://json-schema.org/tools?query=&sortBy=name&sortOrder=ascending&groupBy=toolingTypes&licenses=&languages=&drafts=&toolingTypes=&environments=&showObsolete=false) library for this, and use MongoDB Schema Validation to enforce the types in the database.
210-
211-
Please [contact us](/resources/contact-us) for assistance on either of the above.
209+
Please [contact us](/resources/contact-us) for assistance on any of the above.
212210

0 commit comments

Comments
 (0)