-
Notifications
You must be signed in to change notification settings - Fork 48
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
🚀 Feature: Adding Random option to query #254
Comments
Hi |
Thanks for your replay PostgresSELECT * FROM users ORDER BY random() LIMIT 5; MySQL / MariaDB / SQLiteSELECT * FROM users ORDER BY RAND() LIMIT 5; MongoDBdb.users.aggregate(
[ { $sample: { size: 3 } } ]
) |
Thanks for sharing, adding @fogelito for review/feedback on this idea. |
Hello, @byawitz Thanks for sharing new ideas! |
Hey, @fogelito. Of course, that can be a slow query in RDBMS, I agree, Though there is a way to mitigate it by using to know the number of rows and adding it as a pre-defined var. That means that for every insert to the database, a counter of it will be added (and decreased any delete), this can be another great feature for any case. |
@byawitz Correct, As to count all rows in the collection, but in the case of filtering queries, it will be hard to count all options. |
Thanks @fogelito, |
🔖 Feature description
Adding the option to select n items as random.
The implementation would look something like this
Or with limit as the random parameter.
Adapter are required for:
🎤 Pitch
I first intend to add it as a feature for Appwrite database endpoints.
Also, It can be helpful in games, for example.
👀 Have you spent some time to check if this issue has been raised before?
🏢 Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: