I'm adding new photos to my database in groups as they are uploaded to Instagram. Say my first call to the Instagram API returns 5 photo objects in an array, [20,21,22,23,24]. 20 being the most recent and 24 the oldest. Then my next call several minutes later returns 5 newer photo objects, [15,16,17,18,19]. 15 being the most recent and 19 the "oldest" (but always newer than 20), and on and on.
Ideally I would like my database to store the objects as [15,16,17,18,19,20,21,22,23,24] or [24,23,22,21,20,19,18,17,16,15]. However, if I use push I end up with: [20,21,22,23,24,15,16,17,18,19], while if I use unshift I end up with: [19,18,17,16,15,24,23,22,21,20,]
Aucun commentaire:
Enregistrer un commentaire