Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. var ddoc = {
  2. _id: '_design/following',
  3. views: {
  4. [req.body.userName]: {
  5. map: function (doc) {
  6. for (var key in req.body.following) {
  7. eval(' if (' + req.body.following[key].userName + ' === req.body.userName) { ' +
  8. 'emit(doc.dateApproved);' +
  9. '} ')
  10. }
  11. }
  12. }
  13. }
  14. } ```
  15.  
  16.  
  17. I would like the output to look like this..
  18.  
  19. var ddoc = {
  20. _id: '_design/index',
  21. views: {
  22. TerryFollower: {
  23. map: function(doc) {
  24. if (doc._id === "JohnFollowing") {
  25. emit(doc.dateApproved);
  26. }
  27. if (doc._id === "TimFollowing") {
  28. emit(doc.dateApproved);
  29. }
  30. if (doc._id === "DaveFollowing") {
  31. emit(doc.dateApproved);
  32. }
  33.  
  34. }.toString()
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement