Hi all, something very strange in my production deployment. When I try to view a collection in the admin panel none is being displayed and I see this error message. Any pointer or ideas to what might be the issue?
Oh, wait, what Payload version are you on?
toObjectId was used in an older version that is not compatible with some mongo "compliant" hosting options like documentDB and azure cosmos db
those implementations are missing a bunch of aggregates so we re-wrote them. That error should go away when you upgrade Payload to latest.
"payload": "^1.5.9",
mongodb
db hosted by us
the admin tries to fetch the following url: serverurl/api/home-pages?locale=en&depth=0&draft=true
if we remove the draft=true, it works but the admin sends draft=true
this is the error we're getting if we take the url and try to fetch it via the browser url field:
{
"errors": [
{
"message": "Unrecognized expression '$toObjectId'"
}
]
}
There were a lot of changes to versions since 1.5.9 so you're going to want to upgrade. I'm pretty certain that will solve this for you.
There were some breaking changes and a migration script will be needed if you have data on versioned collections already
Hi Dan, we had an old version of mongodb, once we upgraded it worked. I will take your advice and upgrade to the latest payload version. many thanks for your help!
Star
Discord
online
Get dedicated engineering support directly from the Payload team.