Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8936961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:19:33+00:00 2026-06-15T10:19:33+00:00

I am trying to model friendships using the Parse.com javascript API (essentially backbone models).

  • 0

I am trying to model friendships using the Parse.com javascript API (essentially backbone models). I am using the built in Parse.com User Class. I have a mySQL / relational DB model background, and finding it tricky changing my thinking to a non-sql / denormalized way.

It should support the standard facebook style methods:
– user a can request user b’s friendship
– user b can accept or ignore the friendship request

For a given user I want to be able to fetch a collection of their friends (accepted friendships in both directions).

I had been considering using a Friendships model and referencing the user models as initiators and acceptors:

initiator | acceptor | status
==========+==========+========
user a    | user b   | accepted
user b    | user c   | 
user c    | user a   | accepted

I am unsure if this is the best way, and also unsure about securing it with ACLs. I am concerned that both users in a friendship will need to be able to update the row – in order to remove a friendship. Also, user b should not be able to make requests to the Parse API that would reveal another user’s friendships.

To query for a user a’s friends I would do two queries, one for where user a is the acceptor, and one for the initiator.

Can someone please comment if this is an acceptable way to model this, or if not why not and suggest improvements.
Thanks!

Update 8/8/12:
A problem I see here:
If I set an ACL on each row in the Friendships Class so the initiator may write the row, and it is publicly readable – then the acceptor will not be able to update the row to status = accepted.

Could a friendship be modeled as two rows in the table?
eg:

initiator | acceptor | status
==========+==========+========
user a    | user b   | requested
user b    | user a   | accepted

No idea how I would query that to get a given user’s friends however!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:19:34+00:00Added an answer on June 15, 2026 at 10:19 am

    I decided to implement this with Parse CloudCode to simplify the data security, and lock down all client write access to the Friend class.

    I have three cloud code functions… friendRequest, friendDelete, friendAccept. These functions operate with the master key for doing all write-operations on the friend class. Read ACLs are added to each row for both users in the friendship – so you can only view your own friendships.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to model a network using C++. I have a struct called
I'm trying to model a specialization/generalization, leaning towards using class table inheritance (see this
I'm trying to model my javascript object using visio, visio doesn't support javascript data
I'm trying to model a class that has a method with a variable argument
I am trying to model a simple domain by using DDD. Database layer is
I'm trying to model a asynchronous job processing framework using MailboxProcessor. My requirements are
I'm trying to model class and sections of a class and further instances of
I am trying to model this relationship following this link http://www.javaworld.com/javaworld/jw-01-2008/images/datamodel.gif Its the usual
I am trying to model a publications. A publication can have multiple authors and
This is the SOAP document I'm trying to model using SOAP::Lite. <SOAP-ENV:Envelope xmlns:SOAP-ENC=http://schemas.xmlsoap.org/soap/encoding/ xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.