Hi all im having a problem i needed to use <findRa...
# mongodb
b
Hi all im having a problem i needed to use findRaw to return mongodb docs but i need to to get back an id not
_id: {$oid: 'string}
my prisma.schema has
id                 String                      @id @default(auto()) @map("_id") @db.ObjectId
but that has no affect any thoughts
1
n
Hey Brandon 👋
findRaw
would return the docs as they are stored in the database. Your stored documents would not have an
id
field, it would have a
_id
field as id field is mapped to _id by
@map("_id")
attribute. so the returned documents have a _id field and not id. @map maps a field name or enum value from the Prisma schema to a column or document field with a different name in the database. If you do not use
@map
, the Prisma field name matches the column name or document field name exactly