Skip to content

Empty result set #3325

Closed Answered by bjaysheel
bjaysheel asked this question in Q&A
Mar 14, 2025 · 5 comments · 1 reply
Discussion options

You must be logged in to vote

Thank you, I can confirm, all three solutions worked.

Using raw statement works: for mongodb/laravel-mongodb v5.2 statement was
$raw = \DB::connection('mongodb')->getClient() ->selectCollection('DB_NAME', 'TABLE_NAME') ->find([], ['limit' => 10]) ->toArray();

I also tested overwritting getTable function in my Model
function getTable() { return $this->collection(); }

And finally replaced protected property collection with table @GromNaN suggested. This one worked as well.

Thank you everyone, marking it closed.

Replies: 5 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@bjaysheel
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by GromNaN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #3324 on March 15, 2025 07:47.