-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: developer concepts 2 #47
Closed
MohanNarayana
wants to merge
10
commits into
new-docs-draft-two
from
mohan-new-docs-draft-dev-concepts-2
Closed
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
cbc6763
(feat) proposed new structure
brent-hoover 5a9961f
feat: restore docs folder
brent-hoover 9353dcb
feat: add simple schema doc - dev concepts
MohanNarayana 094b438
feat: add localization, events and how do I doc- dev concepts
MohanNarayana 53ec200
feat: add authentication doc- dev concepts
MohanNarayana e005132
feat: add core plugin development- dev concepts
MohanNarayana 6b737e1
feat: add logging and error handling- dev concepts
MohanNarayana 0be623b
feat: add session based auth note
MohanNarayana b053e3e
feat: add image handling doc- dev concepts
MohanNarayana f214fae
feat: remove dow to doc
MohanNarayana File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Schemas | ||
|
||
Open Commerce uses [MongoDB](https://docs.mongodb.com/manual/), which is a schemaless database. This allows maximum flexibility, particularly important when quickly reacting to the design challenges that uniquely different customizations require in the course of an e-commerce operation. | ||
|
||
However, we don't want to just get completely crazy, so we define a **schema** that is attached to the previously schemaless collection. These schemas apply basic content and structure validation, also very necessary in e-commerce. | ||
|
||
Schemas are implemented using the [simpl-schema](https://github.com/aldeed/simple-schema-js) NPM package. In most cases the schemas can be kept private to the plugin that creates them. Typically, you will import them into a mutation function and validate a document before inserting or updating it. | ||
|
||
```js | ||
OrderSchema.validate(order); // Will throw a validation error if invalid | ||
await Orders.insertOne(order); | ||
``` | ||
|
||
An update example: | ||
|
||
```js | ||
OrderSchema.validate(modifier, { modifier: true }); | ||
|
||
const { value: updatedOrder } = await Orders.findOneAndUpdate( | ||
{ _id: orderId }, | ||
modifier, | ||
{ returnOriginal: false } | ||
); | ||
``` |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
File renamed without changes.
Empty file.
Empty file.
Empty file.
File renamed without changes.
Empty file.
File renamed without changes.
Empty file.
Empty file.
File renamed without changes.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Empty file.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this not a duplicate?