Prisma1: [Mongo] Support more Id Types than just ObjectId

Created on 3 Jan 2019  路  2Comments  路  Source: prisma/prisma1

MongoDB allows you to specify the id of a document with any type as long as it is not an array.

The Prisma Mongo connector so far only handles ObjectIds as valid id types. Opening this up to be as flexible as MongoDB would allow more people with existing dbs to use Prisma.

One concern is that Prisma generates ids internally in some cases, if these are not ObjectIds we would need to be able to ensure uniqueness without knowing how existing ids were generated.

This issue is supposed to serve as a discussion ground for this.

kindiscussion areconnectomongo

Most helpful comment

Because of this. I can't write test cases with custom Id.

All 2 comments

In cases where an id cannot be auto generated, it would must be provided by the user. This is also specced out here. This would then be specified with the NONE strategy:

type Blog {
  id: Float! @id(strategy: NONE)
  name: String!
}

Because of this. I can't write test cases with custom Id.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Fi1osof picture Fi1osof  路  3Comments

MitkoTschimev picture MitkoTschimev  路  3Comments

AlessandroAnnini picture AlessandroAnnini  路  3Comments

nikolasburk picture nikolasburk  路  3Comments

marktani picture marktani  路  3Comments