Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
i'n trying to figure out, what's the best practice for building collections associated with user's data.(In terms of reactive, queries speed, or other.)
For example, what's better?
Meteor.Users.profile: {friends, likes, previous orders, locations, favorites, etc"}.
Or create additional collection to keep this data, for example:
Meteor.UserInfo.user{friends, locations, previous orders, etc").
Thanks.
Use the Users collection to store information about that user that isn't related to other collections. Typically this should be at the top level of the user document, not inside the profile. The only thing I'd expect to see in the profile is profile information (and not, for instance, a list of previous orders).
Things like previous orders shouldn't be there since you can just query the Orders collection to find them. For performance reasons it is sometimes useful to denormalise this data, but this should be an exception, not the rule.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I want to get subscriptions of users.
I can get user one by one then get each user subscriptions.
But this will make many document reads.
i want to get subscriptions 10 by 10 sorted by newest.
is that possible?
Firestore path
we can get users one by one then get each user subscription but this will make many reads
It doesn't matter if you get the documents one by one, or all documents at once, you'll always pay the same price. What I mean is that if you perform a query that returns 5 documents, you'll have to pay 5 read operations. If you read each of those 5 documents, one by one, the same number of read operations you have to pay.
I want to get subscriptions 10 by 10 sorted by newest is that possible?
In that case, you have to perform a query. For that, I recommend you start with the official documentation.
Subcollections: Firestore query subcollections
Pagination: https://firebase.google.com/docs/firestore/query-data/query-cursors
Be aware that asking questions in this way lowers the chances of getting answers.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I am building a social media app and currently, I am storing Usernames, Users, and Posts in Firestore. I am afraid that it will be expensive if there are lots of users(around 50,000). So I planned to store half of the data in Firestore and other half in Realtime Database. Now I am confused if should store the Posts or the Users in Realtime Database. In which database should I put the Posts (Realtime or Firestore)?
Better to stick with 1 source of truth. Between the two I would choose firestore.
There is a pretty good comparison between the two and their tradeoffs here. Do you care only about mobile or do you want your app to work on web and mobile? I'd go with firestore if that is the case.
https://firebase.google.com/docs/database/rtdb-vs-firestore
Also you mention you have Usernames, Users, and Posts in your database. You should be storing usernames in your "Users" collection so you would really only have two different collections for these "Users" and "Posts". Also between the two, you are likely going to have more posts than there are users.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am developing an app in flutter where I have a stories section. Where users can upload stories ( Text / Images). What I want is to automatically delete the posts after one day.
What I have achieved is to delete one day ago data by checking the timestamp of the post and a simple calculation and a remove call to delete it.
But what I want to achieve is an automated process. Like data is automatically deleted after one day without checking for posts on random calls or time. Like I don't know if it's possible or not. But if someone has a solution it would be a great favour. Thakns
Before displaying an item you can check if it is posted in the last 24 hours and if not then don't display it.
To delete the items from Firestore you can set a scheduled job in the backend.
You can use cloud functions pubsub. Write a function like "every one hour find & delete the items that are created before the last 24 hours". Take a look here Schedule functions.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I'm currently going through the process of making sure my Woocommerce websites are compliant with the GDPR legislation coming into effect, May 25th. The default way Woocommerce works is that it stores every order in the database so customers are able to view their previous orders and the admins can process them.
My question is.. Should I introduce a way customers can delete their own orders? Or a maximum amount of time I hold onto these before automatically deleting?
Is there an industry standard for this?
Thanks in advance
What you're looking at is the right for no longer relevant data to be erased. Keep in mind this is different from the right to be forgotten. This does not need to be a programatic thing. Sites like Facebook and Google give a set of admin controls to do this so they don't need to process hundreds of thousands of users individually. The rules state 30 days from request.
A note in site terms on an email to contact to have your data deleted really should suffice. Again keep in mind it is legal to keep sales data, only specific data may be requested to be destroyed. This is paramount in an e-commerce environment.
There are WP plugins to allow users to delete their account but this may cause issues with WC.
A good place to start is with WooCommerces own blog post on the issue
https://woocommerce.com/2017/12/gdpr-compliance-woocommerce/
For full detail of the right of erasure check here
https://ico.org.uk/for-organisations/guide-to-the-general-data-protection-regulation-gdpr/individual-rights/right-to-erasure/
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Let say that I have a website with some information that could be access externally. Those information need to be only change by the respected client. Example: Google Analytic or WordPress API key. How can I create a system that work like that (no matter the programming language)?
A number of smart people are working on a standard, and it's called OAuth. It already has a number of sample implementations, so it's pretty easy to get started.
Simple:
Generate a key for each user
Deny access for each request without this key
Currently, I use a concatenation of multiple MD5s with a salt. The MD5s are generated off of various concatenations of user data.
A good way of generating a key would be to store a GUID (Globally Unique Identifier) on each user record n the database. GUID is going to be unique and almost impossible to guess.
There are also infrastructure services that manage all this for you like http://www.3scale.net (disclosure I work there), http://www.mashery.com and http://www.apigee.com/.