Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. app.get("/getLogs", (req, res) => {
  2. const { db } = req.app.locals;
  3. const changeStream = db.collection("Logs").watch();
  4. changeStream.on("change", function(change) {
  5. db.collection("Logs")
  6. .find()
  7. .toArray(function(err, results) {
  8. logs = results;
  9. // send Data to frontend
  10. });
  11. });
  12.  
  13. app.get("/getLogs", (req, res) => {
  14. const { db } = req.app.locals;
  15. const changeStream = db.collection("Logs").watch();
  16. changeStream.on("change", function(change) {
  17. db.collection("Logs")
  18. .find()
  19. .toArray(function(err, results) {
  20. logs = results;
  21. res.json({results})
  22. });
  23. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement