Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Limit behavior when using join fields #11187

Open
stofolus opened this issue Feb 14, 2025 · 0 comments · May be fixed by #10936
Open

Limit behavior when using join fields #11187

stofolus opened this issue Feb 14, 2025 · 0 comments · May be fixed by #10936
Assignees
Labels

Comments

@stofolus
Copy link
Contributor

Describe the Bug

When using MongoDB and setting a limit together with pagination: false it will behave differently if the collection has a join field or not.

  • Without a join field the limit is respected
  • With a join field the limit is ignored and the full result is returned

I think that the expected behavior is that limit should be ignored. It's a bit confusing though.

I believe that the root cause is that mongoose-paginate-v2 actually does use the limit even if pagination is turned off. Which I would consider a bug.

Link to the code that reproduces this issue

https://github.com/stofolus/mongo-join-bug

Reproduction Steps

  • Start the project with a MongoDB instance
  • Go to /seed
  • Go to /

There are two collections where one have a join field and one does not. They should return the same information on the page.

Which area(s) are affected? (Select all that apply)

db-mongodb

Environment Info

Binaries:
  Node: 22.13.0
  npm: 11.0.0
  Yarn: N/A
  pnpm: 10.0.0
Relevant Packages:
  payload: 3.23.0
  next: 15.1.5
  @payloadcms/db-mongodb: 3.23.0
  @payloadcms/email-nodemailer: 3.23.0
  @payloadcms/graphql: 3.23.0
  @payloadcms/next/utilities: 3.23.0
  @payloadcms/payload-cloud: 3.23.0
  @payloadcms/richtext-lexical: 3.23.0
  @payloadcms/translations: 3.23.0
  @payloadcms/ui/shared: 3.23.0
  react: 19.0.0
  react-dom: 19.0.0
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Tue Nov 5 00:21:55 UTC 2024
  Available memory (MB): 30893
  Available CPU cores: 8
@stofolus stofolus added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction labels Feb 14, 2025
@JarrodMFlesch JarrodMFlesch added the db: mongodb @payloadcms/db-mongodb label Feb 14, 2025
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Feb 14, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
3 participants