0

In the thinky.io docs the following pattern is described to enforce uniqueness:

var Model = thinky.createModel("user",
    name: type.string()
}, {
    pk: "name"
});

Where the name property is assigned to the primary key.

Is this a typo? That is, should it read:

var Model = thinky.createModel("user", {
    name: type.string()
}, {
    pk: "name"
});

Also for anyone familiar with thinky who has used this pattern before, is there a similar way of assigning uniqueness as it is done in mongoose (mongodb):

const userSchema = new Schema({
    name: { type: String, unique: true }
});

Thanks.

Update: link to the docs https://thinky.io/documentation/faq/

alex
  • 5,467
  • 4
  • 33
  • 43

1 Answers1

1

Yes, definitely a typo as the first example is not valid.

Andrew Hill
  • 2,165
  • 1
  • 26
  • 39