Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed spec loader and CastError

  • Loading branch information...
commit d0025dd0c8fae9a3985776bab6be06db4d019dd1 1 parent 42d1146
@goulash1971 authored
Showing with 13 additions and 0 deletions.
  1. +11 −0 lib/index.js
  2. +2 −0  lib/types/dbref.js
View
11 lib/index.js
@@ -16,6 +16,16 @@ exports.utils = utils = require("./utils");
/**
+ * Utility function for typeof array testing
+
+ * @param {Object} the object to be tested as an array
+ * @api private
+ */
+var isArray = Array.isArray || function(obj) {
+ return toString.call(obj) === '[object Array]';
+}
+
+/**
* Utility function that will convert an {Array} of arguments into a
* loading specification consiting of a filter {Function} and an
* {Array} of names.
@@ -26,6 +36,7 @@ exports.utils = utils = require("./utils");
*/
var figureLoadSpec = function (args) {
var spec = {filter: function (name) { return true; }, names: []};
+ if (!isArray(args)) args = [args];
if (args.length == 1) {
if (typeof args[0] === 'function')
spec.filter = args[0];
View
2  lib/types/dbref.js
@@ -8,6 +8,7 @@
*/
var mongoose = require("mongoose");
+
/**
* Utility function that will cast a single object for a condition
*
@@ -51,6 +52,7 @@ exports.loadType = function (mongoose) {
// The types that are used for schema and models
var SchemaType = mongoose.SchemaType;
var SchemaTypes = mongoose.SchemaTypes;
+ var CastError = SchemaType.CastError;
// The native type used for storage
var dbref = mongoose.mongo.BSONPure.DBRef;
Please sign in to comment.
Something went wrong with that request. Please try again.