skip to Main Content

Html – Not connecting to mongo db

var express = require('express'); var router = express.Router(); const MongoClient = require('mongodb').MongoClient; /* GET home page. */ router.get('/', function (req, res, next) { res.render('index', { title: 'Express' }); }); router.post("/signup", function (req, res) { console.log("first_name: " + req.body.first_name) console.log("last_name: "…

VIEW QUESTION

How to lookup a sub-array in mongodb?

I tried to use aggregate and lookup but look like I cannot keep role in the members item. Any idea how to resolve it? db.groups.insertMany([ { title: 'Hi', members: [ { userId: ObjectId('62589515f239750e7e44b958'), role: 'Admin' }, { userId: ObjectId('655f634c632d0c23b9d455de'), role:…

VIEW QUESTION
Back To Top
Search