Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.get("/getLogs", (req, res) => {
- const { db } = req.app.locals;
- const changeStream = db.collection("Logs").watch();
- changeStream.on("change", function(change) {
- db.collection("Logs")
- .find()
- .toArray(function(err, results) {
- logs = results;
- // send Data to frontend
- });
- });
- app.get("/getLogs", (req, res) => {
- const { db } = req.app.locals;
- const changeStream = db.collection("Logs").watch();
- changeStream.on("change", function(change) {
- db.collection("Logs")
- .find()
- .toArray(function(err, results) {
- logs = results;
- res.json({results})
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement