1

I'm using loopback to build an application, and would like to write a custom remote method which returns a random model instance from the database.

Is there a way to do this using the built-in ORM?

Thanks!

rdegges
  • 32,786
  • 20
  • 85
  • 109

1 Answers1

2

There is no built-in way. You can do it manually depending on the type of data source you're using.

See https://groups.google.com/forum/#!searchin/loopbackjs/random/loopbackjs/C08v1K0NKHk/8nUp9VSGEhEJ

superkhau
  • 2,781
  • 18
  • 9
  • Thanks! Would be cool to get random() stuff added into the ORM, but that's a totally non-SO related thingy ^^ – rdegges Mar 05 '15 at 06:34
  • Feel free to submit a feature request. See https://github.com/strongloop/loopback/wiki/Reporting-issues#featureenhancement-request – superkhau Mar 05 '15 at 20:14