#5028·FerretDB

mongoDB views issue

Author: chndnpCreated Apr 7, 2025Updated Feb 12, 2026
Labelscode/bugnot ready

FerretDB, PostgreSQL, and DocumentDB versions

json
{
"FerretDB": "ghcr.io/ferretdb/ferretdb:2.1.0",
"PostgreSQL": "ghcr.io/ferretdb/postgres-documentdb:17-0.102.0-ferretdb-2.1.0",
"DocumentDB": "ghcr.io/ferretdb/postgres-documentdb:17-0.102.0-ferretdb-2.1.0"
}

Environment

  • OS: Ubuntu 20.04
  • Deployment: Docker using ghcr.io/ferretdb/ferretdb:2.1.0 image
  • Deployment details: docker version 24.0.2

What did you do?

When i create a mongoDB view, ferretdb throws the below error in the logs:

2025-04-07T15:41:49.591Z    ERROR    documentdb_api/documentdb_api.go:25    Query    {"args":{"0":"upp-ferretdb","1":"RawDocument<940>","2":0},"error":"ERROR: can't $divide by zero (SQLSTATE M0001)","name":"pool","pid":14335,"sql":"SELECT cursorpage::bytea, continuation::bytea, persistconnection, cursorid FROM documentdb_api.aggregate_cursor_first_page($1, $2::bytea, $3)","time":22362625}
2025-04-07T15:41:49.591Z    WARN    clientconn/conn.go:612    Response header: length:   105, id:   80, response_to: 1884, opcode: OP_MSG    {"name":"listener"}
2025-04-07T15:41:49.591Z    WARN    clientconn/conn.go:613    Response message:
{
  `FlagBits`: `[]`,
  `Checksum`: int64(0),
  `Sections`: [
    {
      `Kind`: 0,
      `Document`: {
        `ok`: 0.0,
        `errmsg`: `can't $divide by zero`,
        `code`: 2,
        `codeName`: `BadValue`,
      },
    },
  ],
}    {"name":"listener"}

Is view creation not part of ferretDB yet?

What did you expect to see?

A working view

What did you see instead?

The view is not working, ie, it is not returning any data.