Skip to content

Commit 3d673f5

Browse files
authored
Update browser.md with Mongoose limitations
The current browser.md explains that the browser build is limited, but it doesn’t clearly list what actually works. This update adds a short note to make the behavior more understandable. The note now clarifies that: • Browser build supports only schema-based validation. • Built-in validators and custom validators work with validate()/validateSync(). • Setters/getters work as expected. • Models, queries, defaults, middleware, and all database operations are not available in the browser build. This makes the browser section clearer and reduces confusion for developers using validation on the frontend.
1 parent dfa12ca commit 3d673f5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/browser.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,10 @@ const doc = new mongoose.Document({}, new mongoose.Schema({
3434
}));
3535
// Prints an error because `name` is required.
3636
console.log(doc.validateSync());
37+
> **Note:** The browser version of Mongoose supports only schema-based
38+
> validation. Built-in validators (like `required`, `enum`, `minlength`) and
39+
> custom validators work as expected using `validate()` or `validateSync()`.
40+
> However, browser Mongoose does **not** support models, queries, defaults,
41+
> middleware (hooks), or any database operations. Only document validation
42+
> is available in the browser build.
3743
```

0 commit comments

Comments
 (0)