Skip to content

️ deps(dev): Bump prisma from 3.5.0 to 3.12.0

Yogi Bot requested to merge dependabot-npm_and_yarn-prisma-3.12.0 into main

Bumps prisma from 3.5.0 to 3.12.0.

Release notes

Sourced from prisma's releases.

3.11.1

Today, we are issuing the 3.11.1 patch release.

MongoDB (Preview)

Breaking: Filters no longer return undefined fields by default

In 3.11.1, we've changed what data is returned when filtering MongoDB documents on undefined fields. The new rule is that undefined fields are excluded by default unless explicitly filtered for. This allows you to query for undefined and null values separately.

Let's take a look at a concrete example. Given the following Prisma schema:

model Address {
    id     Int    @id @map("_id")
    city   String
    street String? // Note that street is optional
}

For Mongo, optional fields can either be null or undefined (absent). The following documents are all valid for the schema above:

{ "_id": 1, "city": "San Fransisco", "street": "Market st." }
{ "_id": 2, "city": "Seattle", "street": null }
{ "_id": 3, "city": "Chicago" }

Prior to 3.11.1, if you queried for where: { street: null }, you'd get _id: 2 and _id: 3. In 3.11.1, you'll only get _id: 2. The ability to also query for the missing fields has also been added. For details, refer to the new isSet below to learn more.

There are a few exceptions to this new default:

  • A having filter on an aggregated field will return undefined fields. This is because aggregation on undefined fields yields null, not undefined, thus matching the filter.
  • Filters on undefined to-many relations (e.g., the backing array of a many-to-many is undefined) will currently include those relations in the result set.

New isSet filter operation

To compensate for missing fields on documents no longer being returned by the filters above, we’ve added a new isSet: bool filter. This filter can be used to include fields that are undefined on documents.

Using the example above, to include the undefined fields, you can use an OR:

await prisma.address.findMany({
  where: {
    OR: [
      { street: { isSet: false } },
      { street: null }
    ]
  }
})

... (truncated)

Commits

Merge request reports