- Laravel-mongodb Version: 4.3 - PHP Version:8.3.7 ### Description: Getting **This method is not supported by MongoDB. Try \"toMql()\" instead** on withCount function
Activity
omerkoseoglu commentedon Jun 14, 2024
Rahul-codoffer commentedon Jun 17, 2024
GromNaN commentedon Jun 17, 2024
Could you please provide a sample code to reproduce the issue. Some features are not supported with MongoDB or require some additional work.
hooman-mirghasemi commentedon Jun 29, 2024
I have same problem in laravel 10 php 8.3 and this package latest version 4.5
GromNaN commentedon Jun 29, 2024
@hooman-mirghasemi Same question.
hooman-mirghasemi commentedon Jul 4, 2024
make a model in mysql "post"
then make an other one in mongo db "comments"
make hybrid relationships
Post::withCount('comments')->get();
MiladAheshmeh commentedon Aug 28, 2024
MiladAheshmeh commentedon Sep 10, 2024
alcaeus commentedon Sep 10, 2024
arjundexbytes commentedon Mar 11, 2025
Same issue with me
Athul-Suresh commentedon Jul 3, 2025
Same issue with me also
"php": "^8.2",
"laravel/framework": "^12.0",
"mongodb/laravel-mongodb": "^5.4",
Sample Code
Post::where('status",1)->withCount('comments')->get()
Error:
"message": "This method is not supported by MongoDB. Try "toMql()" instead.",
"exception": "BadMethodCallException",
alcaeus commentedon Jul 9, 2025
We are tracking this internally as PHPORM-238 and will close out this issue once we've added support for
withCount
.Athul-Suresh commentedon Jul 10, 2025
Thanks for the update!