Loopback: .random() API Call for ORM

Created on 5 Mar 2015  路  9Comments  路  Source: strongloop/loopback

Hi all, started using loopback recently, and am loving it.

One thing I'd love to see is a .random() model method. It'd be nice to occasionally select a random item from the datababase.

I know that in active record / Django / most other ORMs, it's possible to execute these sort of queries in different ways, and I figured it'd be worth a github issue.

Best,

-Randall

feature stale

Most helpful comment

Well, that's definitely one way to close out issues.

All 9 comments

+1 would love to see this as a buildin feature!

:+1: same here

+1

+1

for what it's worth, I solved it on my side by creating a mixin, it's by far the easiest way... I'm right now only using MySQL, so didn't add support for other connectors, but it would be easily done...

https://gist.github.com/pmoelgaard/bf1091d5827e85d5a27f

+1

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

Well, that's definitely one way to close out issues.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

germanamz picture germanamz  路  3Comments

futurus picture futurus  路  3Comments

rkmax picture rkmax  路  3Comments

Overdrivr picture Overdrivr  路  4Comments

cajoy picture cajoy  路  4Comments