Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Improve methods to abstract queries on MongoDB #68

Open
rplansky opened this issue Oct 24, 2014 · 0 comments
Open

Improve methods to abstract queries on MongoDB #68

rplansky opened this issue Oct 24, 2014 · 0 comments
Assignees
Labels

Comments

@rplansky
Copy link
Contributor

rplansky commented Oct 24, 2014

Currently, if we need to perform a query using Model class, we need to know too much about how query works in MongoDB.

The idea is to create some methods to abstract these queries.

Examples

Today

$posts = Post::find(['tag' => 'mongolid', 'approved' => true])
    ->limit($limit)
    ->skip(($page - 1) * $limit)
    ->sort(['created_at' => -1]);

Suggestion

$posts = Post::tag('mongolid')
    ->approved(true)
    ->newest()
    ->get($limit, $page);

Note: We would still be able to use the "old" method.

We need to talk a little bit about it :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants