Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade calls to insert() and update(), to match with Mongodb driver ~~v2~~ v4's API #62

Open
6 of 13 tasks
adrienjoly opened this issue Jul 15, 2017 · 4 comments
Open
6 of 13 tasks
Assignees
Labels
Projects

Comments

@adrienjoly
Copy link
Member

adrienjoly commented Jul 15, 2017

background: migration to mongodb driver v2 caused a bug: clicking on notification link after adding a track leads to /u/undefined (now fixed), because the inserted/updated data object is now stored as the first element of a ops array property, instead of being returned directly by insert() & update() calls. (see upgrade guide and my comment on mongodb driver's upgrade guide), and #61 (comment)).

=> other features relying on data returned by calls to insert() and update() are also affected by this breaking API change => we need to fix them.

Documentation of new version of the API: insert and update. (both deprecated → to be replaced by calls to insertOne(), insertMany(), updateOne() and updateMany(), keeping in mind that updateOne() may not return the updated data )

next steps:

add automated API tests that should pass with mongodb driver v1 but not on v2 for the following calls to insert(), then fix these calls to make tests pass with mongodb driver v2:

  • savePost function in app/models/post.js (=> issue, fix)
  • rePost function in app/models/post.js (=> api test, fix, acceptance test)
  • insertNotif function in app/models/notifs.js
  • add endpoint in app/models/activity.js
  • save function in app/models/plContest.js
  • addFeaturedendpoint in app/controllers/discover.js

add automated API tests that should pass with mongodb driver v1 but not on v2 for the following calls to update(), then fix these calls to make tests pass with mongodb driver v2:

  • several calls in app/models/post.js
  • several calls in app/models/user.js
  • cvrImg endpoint in app/controllers/api/user.js
  • add function in app/models/follow.js
  • several calls in app/models/track.js
  • cacheFbFriends function in app/models/facebook.js
  • several calls in app/models/notif.js

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@adrienjoly
Copy link
Member Author

adrienjoly commented Jul 17, 2017

merged #64 (automated tests) to master

@adrienjoly
Copy link
Member Author

merged #68 (bug fix #65 : new comment is not displayed properly before page reload)

= good example of fix caused by this mongodb-driver upgrade

adrienjoly added a commit that referenced this issue Jul 20, 2017
in abandoned feature's code collabPl.js (collaborative playlists), for #62
@adrienjoly
Copy link
Member Author

adrienjoly commented Sep 13, 2017

doing "insertNotif function in app/models/notifs.js":

clean notifications db => ok
clear all notifications => ok
add sample notifications => ok
clear all notifications => ok
check that db is clean => ok
add sample notifications (again) => ok
clear individual notifications => ok
check that db is clean => ok
call notif.sendTrackToUsers() with no parameters [should fail] => ok
call notif.sendTrackToUsers() without pId parameter [should fail] => ok
call notif.sendTrackToUsers() with a object-typed pId parameter [should fail] => ok
gilles sends a track to me => ok
clear all notifications => ok
gilles sends a playlist to me => NOK
clear all notifications => ok

(1 failing test)

adrienjoly added a commit that referenced this issue Sep 13, 2017
Migrate insert() call from models/notif.js, for #62
@adrienjoly adrienjoly moved this from ⚙ In progress to 📓 Backlog / Next in Development Nov 19, 2017
@adrienjoly adrienjoly moved this from ⚡️To Do Next to 📥 Inbox / ideas in Development Aug 25, 2020
@adrienjoly adrienjoly moved this from 📥 Inbox / ideas to ⚡️To Do Next in Development Nov 28, 2020
@adrienjoly
Copy link
Member Author

adrienjoly commented Jul 27, 2023

Partially done in #630.

Related to #634.

@adrienjoly adrienjoly changed the title Upgrade calls to insert() and update(), to match with Mongodb driver v2's API Upgrade calls to insert() and update(), to match with Mongodb driver ~~v2~~ v4's API Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development
  
⚡️To Do Next
Development

No branches or pull requests

1 participant