-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DuplicatePrimaryKeyError on non primary key field #628
Comments
What's the code?
…On Thu, Aug 17, 2017, 20:40 Justin Keller ***@***.***> wrote:
I have the following model:
'use strict';
const orm = require('../lib/orm.js');
const type = orm.type;
const config = require('../lib/config.js');
const uuid = require('node-uuid');
const Check = module.exports = orm.createModel(orm.getTableName(__filename), {
id: type.string().uuid(4).default(() => {
return uuid.v4();
}),
domain: type.string().required().allowNull(false).min(1),
result: type.object().required().allowExtra(true).allowNull(true),
created: type.date().default(orm.r.now())
}, {
pk: 'id',
table: config.rethinkdb.table,
enforce_extra: 'strict' // jshint ignore:line
});
Check.ensureIndex('domain');
Check.ensureIndex('created');
Which is the primary key is defined as id. However when I try to save()
multiple documents with the same domain I am getting
DuplicatePrimaryKeyError.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#628>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABZOu6o4OMB-t_jkHw7t4jzlT8rMgfHOks5sZQejgaJpZM4O7EH5>
.
|
Sure, so I have two models:
And:
Note that I have not defined the |
How do you save your document? The duplicate key error is thrown on the primary key, secondary indexes can handle duplicate key. |
After creating an |
I have the following model:
The primary key is defined as
id
. However when I try tosave()
multiple documents with the samedomain
I am gettingDuplicatePrimaryKeyError
.The text was updated successfully, but these errors were encountered: