Permalink
Browse files

README: Added newlines to fix code blocks

  • Loading branch information...
1 parent 70aea58 commit e82ea16ce7bb3cbd5d799609620e3354b7d1cefa @Turbo87 Turbo87 committed Feb 16, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 README.md
View
@@ -2,34 +2,41 @@ mongoose-types - Useful types and type plugins for Mongoose
==============
### Types include:
+
- Email
- Url
### Plugins include:
+
- useTimestamps
Adds `createdAt` and `updatedAt` date attributes that get auto-assigned to the most recent create/update timestamp.
### Installation
npm install mongoose-types
### Setup
+
To include all of the defined types:
+
var mongoose = require("mongoose");
var db = mongoose.createConnection("mongodb://localhost/sampledb");
var mongooseTypes = require("mongoose-types");
mongooseTypes.loadTypes(mongoose);
You can also specify that you only want to load and use a limited subset of the types provided:
+
var mongoose = require("mongoose");
var db = mongoose.createConnection("mongodb://localhost/sampledb");
var mongooseTypes = require("mongoose-types");
// Only load the email type
mongooseTypes.loadTypes(mongoose, "email");
### Using the types
+
Once you are setup, you can begin to use the new types.
#### Email
+
var Email = mongoose.SchemaTypes.Email;
var UserSchema = new Schema({
email: {
@@ -39,6 +46,7 @@ Once you are setup, you can begin to use the new types.
});
#### Url
+
var Url = mongoose.SchemaTypes.Url;
var VisitSchema = new Schema({
url: Url
@@ -76,15 +84,20 @@ Once you are setup, you can begin to use the new types.
});
## Tests
+
To run tests:
+
make test
### Contributors
+
- [Brian Noguchi](https://github.com/bnoguchi)
### License
+
MIT License
---
### Author
+
Brian Noguchi

0 comments on commit e82ea16

Please sign in to comment.