Skip to content
Browse files

Merge pull request #15 from Turbo87/patch-1

README: Added newlines to fix code blocks
  • Loading branch information...
2 parents 70aea58 + e82ea16 commit 544613ef10c1a2a3ac3dcb0841ce155a184e4582 @bnoguchi committed
Showing with 13 additions and 0 deletions.
  1. +13 −0 README.md
View
13 README.md
@@ -2,10 +2,12 @@ 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.
@@ -13,13 +15,16 @@ mongoose-types - Useful types and type plugins for Mongoose
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");
@@ -27,9 +32,11 @@ You can also specify that you only want to load and use a limited subset of the
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 544613e

Please sign in to comment.
Something went wrong with that request. Please try again.