In my application the user can view an image and click on the 'next' or 'previous' photo button. Currently, the logic for pulling the next / previous image urls is based on the 'created_at'
field. I am trying to pick all documents from my collection where the 'created_at'
date is greater than the current resource's (being viewed by the user) value. However, the first document that is returned has the same 'created_at'
value as my current resource's 'created_at'
field.
Eloquent Query:
$photos = Photo::where('_id', '!=', $this->_id)
->where('created_at', '>', $this->created_at)
->orderBy('created_at', 'ASC');
Using:
- Laravel 4.2
- Mongodb 2.6.10
- Library: jenssegers/mongodb 2.*
Any help will be much appreciated!
Thank you