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 7817165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:08:36+00:00 2026-06-02T06:08:36+00:00

I’m working on an app (Rails 3.2, Mongoid) that takes all (by all I

  • 0

I’m working on an app (Rails 3.2, Mongoid) that takes all (by all I mean ‘a lot’) photos from a user. First, we get the albums (<userid>/albums), then, for each album, we take the photos in it (<albumid>/photos), then, the user photos (<userid>/photos). Then we do some operations on each photo, and save them to a DB.

Right now, as a safety net, for each ‘orphan’ photo, I check if the photo is not already present, to avoid duplicates. The current check is done on the db with a exists query. However, is makes lots of db queries, and this is not acceptable. I tried to do it server side, using an array to keep track of the photos, but it was way slower (I used Array#select if my memory is correct).

So, two questions : 1/ Is this ‘safety net’ useful, or can I take for granted that the orphan photos cannot be duplicates ? I’m thinking yes, but I think the check is done for a reason.
2/ If I have to check in order to be sure that there is no duplicates in the database, how should I do it in order to be efficient ?

EDIT

Ok looks like there truly can be duplicates, so question 1/ is solved. Now about 2: is it possible to “guess” from the retrieved photo fields if it belongs to an album, even though there’s no field like album_id ? As in “if the photo is not from user and user is tagged in” -> orphan ?

Thanks for you time!

  • 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-02T06:08:39+00:00Added an answer on June 2, 2026 at 6:08 am

    Yes you can 🙂

    From the documentation: Photo FQL table

    For a given photo with id XXXXXX:

    select owner,album_object_id from photo where object_id=XXXXXX
    

    If you don’t get anything, that means you queried a photo which is out of your

    access token reach (query a photo of someone else).

    You need user_photos permission to access the user photo or friends_photos to access one of the user friends photo.

    Otherwise, you should have the album id of that photo in album_object_id

    Make sure in the Graph API explorer to click the Get Access Token button and check the user_photos permission when you test the query.

    P.S.

    I have tested this on various photos just to be sure and all tests came back positive 🙂

    Link to test in Graph API explorer:

    https://developers.facebook.com/tools/explorer/?method=GET&path=fql%3Fq%3Dselect%20owner%2Calbum_object_id%20from%20photo%20where%20object_id%3DXXXXXXXX 
    

    (don’t forget to change the XXXXXXXX with the photo id)

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I know there's a lot of other questions out there that deal with this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace

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.