Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update README with schema 'type' use

  • Loading branch information...
commit c974aa2d68b9f38b458cc5990e0be9a802a7ca7c 1 parent 73e7bd1
Aaron Heckmann aheckmann authored
Showing with 23 additions and 0 deletions.
  1. +23 −0 README.md
23 README.md
View
@@ -316,6 +316,29 @@ new values to `next`:
})
```
+### Schema gotcha
+
+`type`, when used in a schema has special meaning within Mongoose. If your
+schema requires using `type` as a nested property you must use object notation:
+
+``` javascript
+new Schema({
+ broken: { type: Boolean }
+ , asset : {
+ name: String
+ , type: String // uh oh, it broke. asset will be interpreted as String
+ }
+});
+
+new Schema({
+ works: { type: Boolean }
+ , asset : {
+ name: String
+ , type: { type: String } // works. asset is an object with a type property
+ }
+});
+```
+
## API docs
You can find the [Dox](http://github.com/visionmedia/dox) generated API docs at
Please sign in to comment.
Something went wrong with that request. Please try again.