Comments (14)
I did not look into pagination yet, I will try to add it today.
from laravel-mongodb.
Oh I see. Thanks.
EDIT: Actually what I want to do requires take()
and skip()
instead, so currently I don't need paginate()
for now.
from laravel-mongodb.
Pagination was actually working already when I tried it.
$reports = Report::paginate(5);
Returned me 5 items, and pagination links.
from laravel-mongodb.
Interesting, no matter where I put the call to pagination method in the chain, it wouldn't work.
from laravel-mongodb.
Take and skip is working as well, those are tested by unittests.
from laravel-mongodb.
Can I see your chain?
from laravel-mongodb.
Yes they are working fine.
User::where('attribute', 'value')->orderBy('attribute')->paginate(number);
from laravel-mongodb.
I was able to execute the following without any errors:
$reports = Report::where('node', 'vmware2')->orderBy('elapsed')->paginate(5);
But when I look at your error message, the query builder started using the aggregation framework. Did you use any grouping or aggregation somewhere else or in the same query?
from laravel-mongodb.
Not to my knowledge. If I have, then I've used it without knowing. I have 2 weeks experience of PHP/Laravel. If you say it works, then it probably does and I've done something stupid.
Off-topic: Since MongoDB can have arrays inserted into them, does this package support something like where()
but for matching an item in the array? Currently doing it manually and therefore cannot use Eloquent methods, making things like skip()
and take()
a bit harder.
from laravel-mongodb.
Yes, you can just use something like this:
User::where('address.country', 'France')->get();
from laravel-mongodb.
I think we are thinking of slightly different arrays. I was thinking of having inserted:
array('tag1', 'tag2', 'games', 'entertainment')
into a field tags
. Then I would want to find all models in which its array in tags
contain for example games
. There isn't anything like that is there?
from laravel-mongodb.
You can use this query for that:
Post::where('tags', 'games')->get();
Check 92754b8
from laravel-mongodb.
Oh I see. So that does work. Thanks very much for your help. Much appreciated.
from laravel-mongodb.
How to conver to array when use pagination.
I using Laravel 5.4 and jensseger mongodb 3.2
from laravel-mongodb.
Related Issues (20)
- NOTIFIABLE NOT WORKING, Cannot access offset of type MongoDB\BSON\ObjectId in isset or empty in HOT 1
- MorphTo relation won't work when eager load if target model has different primary key HOT 1
- [BUG] hasMany and hasOne relation not working with ObjectId HOT 2
- toSql() Alias from toMql() HOT 4
- [Feature Request] Add enum collection cast HOT 1
- MongoDB\Driver\Exception\BulkWriteException: not primary in /app/vendor/mongodb/mongodb/src/Operation/Update.php:209 HOT 2
- Polymorphic One to One (MorphOne) Relationship [Feature Request] HOT 3
- BelongsToMany detach() doesn't remove id from both collections
- Transaction level not working when use closure
- Unique Rule ignoring fails
- morphOne $model (mysql) -> relation (mongo)
- how it's will work with laravel passport with crearting issue not able to generate personal access token or password HOT 1
- updateOrCreate does not create DB entries HOT 9
- PHPStan errors after 4.3.0 upgrade HOT 1
- How I use laravel passport with this mongodb package ? As I creating Apis for my project so I require passport package. HOT 1
- `createOrFirst` is not triggering `creating` nor `created` model events HOT 8
- [Feature Request] getChanges() not supported HOT 4
- updateOrCreate -> createOrFirst doesn't work as expected HOT 3
- Memory leak when setting nested keys using dot notation HOT 3
- [Feature Request] Use transaction in AWS DocumentDB HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-mongodb.