Skip to content

Commit

Permalink
set id as optional
Browse files Browse the repository at this point in the history
  • Loading branch information
openhoat committed Jul 27, 2016
1 parent e89e03f commit dbd2854
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/entity.js
Expand Up @@ -455,7 +455,12 @@ class Entity {
logger.enabledLevels.debug && log.debug('saving new "%s" entity', type);
return entity.validate('new');
})
.then(() => entity.generateId())
.then(() => {
if (typeof entity.getId() !== 'undefined') {
return;
}
return entity.generateId();
})
.then(() => entity.checkIndexes())
.then(() => entity.saveIndexes(localMulti)
.then(() => entity.saveLinks(localMulti))
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "hw-redis-ohm",
"version": "0.5.4",
"version": "0.5.5",
"description": "Redis Object Hash Mapping",
"main": "lib/ohm.js",
"scripts": {
Expand Down

0 comments on commit dbd2854

Please sign in to comment.