Skip to content

Commit

Permalink
fix. Any 12 letter string was considered an objectid Automattic/mongo…
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiago Relvao committed Jul 15, 2015
1 parent 710aafe commit 3de7463
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/index.js
Expand Up @@ -120,7 +120,7 @@ module.exports = function (mongoSchema, options) {
function convertToObjId(item, ref) {
var err;

if (mongoose.Types.ObjectId.isValid(item)) {
if (/^[a-fA-F0-9]{24}$/.test(item)) {
return item;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "lackey-mongoose-ensure-object-ids",
"version": "0.0.3",
"version": "0.0.4",
"description": "Replaces unique data like a slug for an ObjectId",
"main": "lib/index.js",
"scripts": {
Expand Down

0 comments on commit 3de7463

Please sign in to comment.