Permalink
Browse files

do not define schemas if not required

  • Loading branch information...
pmlopes committed Jul 10, 2012
1 parent 7336f6d commit f928d5bcebd7890847bc85c16a1ed9683f0ce8da
Showing with 8 additions and 9 deletions.
  1. +0 −3 README.md
  2. +8 −6 lib/model.js
View
@@ -99,9 +99,6 @@ Removes all documents satisfying `query`.
#### Model#update(query, document, options, callback)
Update all documents satisfying `query`, with document.
-#### Model#asModel(obj)
-Utility function to convert a JSON object to a Model class without breaking any linked references (e.g.: a object in an array).
-
#### Model#loadDbRef(id/ids, options, callback)
Loads one Id or array of ids, it is similar to a simple find, however the number of results and order is the same as the array argument
View
@@ -123,12 +123,14 @@ module.exports = function (mongoCollection, schemaDef) {
var odm = this;
- /**
- * schema for embedded objects
- *
- * @memberOf Model
- */
- Object.defineProperty(Model, '$schema', {value: odm.createSchema(schemaDef)});
+ if (schemaDef !== undefined && schemaDef !== null) {
+ /**
+ * schema for embedded objects
+ *
+ * @memberOf Model
+ */
+ Object.defineProperty(Model, '$schema', {value: odm.createSchema(schemaDef)});
+ }
/**
* Keep track of embeds (it is similar to prototype)

0 comments on commit f928d5b

Please sign in to comment.