Parse.com Database design for likes/comments`

user3264361

I am working on an application which will have users.. who create posts.. and other users can like/comment on any post.

I am trying to figure out a best way to design db tables for this. I have read the anypics tutorial on parse.com site. They keep all comments and likes in a table called "Activity". (which makes sense) being able to query any type of activity (like/comment) from a separate table without having to touch "posts" table.

My question is- in this scenario how do I fetch all posts that current user created along with likes and comments on each those posts?

Anypic app by parse makes a separate request to fetch number of likes on each post (which I think is not ideal.) I am new to nosql data stores.. so if someone could help me out with suggestion on how to structure data that would be great.

Also, how bad is it to store all likes/comments as an array in the post itself? I think this won't scale but I might be wrong.

Thanks

Timothy Walters

In terms of Parse, I would use an afterSave Cloud Function to update the Post anytime a like/comment is added.

Have a look at the documentation here, in the most simple case you just create an afterSave for the Activity class that increments the like/comment count.

In a more advanced scenario you might want to handle update/delete too. E.g. if someone can change their 'like' to 'not like' you would need to look at the before/after value and increase/decrease the counter as needed.

I am a fan of storing extra 'redundant' data, and no-sql/document-db systems work well for that. This is based on the idea that writes are done infrequently compared to the number of reads, so doing some extra work during/after the write has less impact and makes the app work more smoothly.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Database design for a classroom application using Parse.com

From Dev

Database design for a classroom application using Parse.com

From Dev

Saving "likes" database design (Parse)

From Dev

Issue with Parse.com database

From Dev

Saving to Parse.com database in applicationDidEnterBackground

From Dev

Parse.com Database Query browser

From Dev

Parse.com modifying an object in local database

From Dev

Connect Parse.com Database to Tableau

From Dev

How to Append a column in parse.com database

From Dev

Adding information to the database Parse.com

From Dev

Limitations of Parse.com database-structure

From Dev

Multi-platform database with parse.com

From Dev

How to update local parse.com database incrementally?

From Dev

Connecting Arduino Uno with Ethernet shield to parse.com database

From Dev

Parse.com - Request from cloud to database is considered as one request?

From Dev

How to retrieve data from parse.com database (Android)?

From Dev

Adding information to the database Parse.com error PFObject

From Dev

Connecting Arduino Uno with Ethernet shield to parse.com database

From Dev

Why is the default User Database on Parse.com called "_User"?

From Dev

Delete item from the database of Parse.com (iOS App)

From Dev

Storing user contacts on server database (parse.com)

From Dev

Only one field is getting added in parse.com database

From Dev

Find ids which is not connected to objects in parse.com database

From Dev

Data model design for Parse

From Dev

Parse.com query and application design issue: A long-running operation is being executed on the main thread

From Dev

My database design for movie database

From Dev

Related to database schemas and design

From Dev

Database design decision

From Dev

Database Design and normalization in chess

Related Related

  1. 1

    Database design for a classroom application using Parse.com

  2. 2

    Database design for a classroom application using Parse.com

  3. 3

    Saving "likes" database design (Parse)

  4. 4

    Issue with Parse.com database

  5. 5

    Saving to Parse.com database in applicationDidEnterBackground

  6. 6

    Parse.com Database Query browser

  7. 7

    Parse.com modifying an object in local database

  8. 8

    Connect Parse.com Database to Tableau

  9. 9

    How to Append a column in parse.com database

  10. 10

    Adding information to the database Parse.com

  11. 11

    Limitations of Parse.com database-structure

  12. 12

    Multi-platform database with parse.com

  13. 13

    How to update local parse.com database incrementally?

  14. 14

    Connecting Arduino Uno with Ethernet shield to parse.com database

  15. 15

    Parse.com - Request from cloud to database is considered as one request?

  16. 16

    How to retrieve data from parse.com database (Android)?

  17. 17

    Adding information to the database Parse.com error PFObject

  18. 18

    Connecting Arduino Uno with Ethernet shield to parse.com database

  19. 19

    Why is the default User Database on Parse.com called "_User"?

  20. 20

    Delete item from the database of Parse.com (iOS App)

  21. 21

    Storing user contacts on server database (parse.com)

  22. 22

    Only one field is getting added in parse.com database

  23. 23

    Find ids which is not connected to objects in parse.com database

  24. 24

    Data model design for Parse

  25. 25

    Parse.com query and application design issue: A long-running operation is being executed on the main thread

  26. 26

    My database design for movie database

  27. 27

    Related to database schemas and design

  28. 28

    Database design decision

  29. 29

    Database Design and normalization in chess

HotTag

Archive