Like what we’re doing? Star us on GitHub!

Collection not being shown in admin panel

liorix
last month
14

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?

image.png
  • dribbens
    Payload Team
    last month

    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.

  • liorix
    last month

    "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'"


    }


    ]


    }

  • dribbens
    Payload Team
    last month

    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



    https://github.com/payloadcms/payload/blob/master/CHANGELOG.md#-breaking-changes
  • liorix
    4 weeks ago

    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!

Open the post
Continue the discussion in Discord
Can't find what you're looking for?
Get help straight from the Payload team with an Enterprise License.Learn More