I keep getting TypeError: Cannot read properties of undefined (reading ‘length’) and I can’t seem to find the source of the error
const userRegistrationPost = (req, res) => {
const{name, email, pass1, pass2} = req.body;
MongoDB data not being fetched on the frontend
import React, { useState, useEffect } from ‘react’; import Navbar from ‘../../components/navbar/Navbar’; import ‘./Chat.css’; function Chat() { const [messages, setMessages] = useState([]); const [input, setInput] = useState(”); useEffect(() => { const fetchMessages = async () => { try { const response = await fetch(‘http://localhost:3000/chats’); if (!response.ok) { throw new Error(‘Network response was not ok’); } […]
MongoDB server closed when POST requesting
I’m trying to test out a post request on Postman and I’m getting the 200 but is not reflected on Mongo and I’m getting an error in the console saying server is closed at Server.command.
Mongo db command find requires authentication
With node js i connect to mongo db.
microservices communications and creating shared models
I am wondering on how a microservices communication and data modeling would go on. It is a nodejs-mongodb, part of self-learning. I am seeing they need separate repos.
Getting information from the MongoDB database in the form of printing pages
I want to implement сode in nodejs on how to select pages when printing pages for printing from the MongoDB database in such a way that they are cut or selected using a string of information and all are received together in an array. Like the following example:
Field of choice: 1, 4, 5-7, 8, 10-100
In this case, data numbers 1, 4, 5 to 7, 8, and 10 to 100 are extracted from all the data in the Mongo database.
monogdb not connecting properly with node
var express = require(‘express’); var router = express.Router(); var MongoClient = require(‘mongodb’).MongoClient /* GET home page. */ router.get(‘/’, function(req, res, next) { res.render(‘index’,{title: ‘Express’}); }); router.post(‘/submit’,function(req, res) { console.log(req.body) MongoClient.connect(‘mongodb://localhost:27017/’,function(err,client){ if(err) console.log(‘error’) else console.log(‘Database connected’) }) res.send(‘Form submitted successfully’); }); module.exports = router; Error showing in the terminal like below while submitting a form, terminal […]
Nodejs & mongodb
Ive taken all the async out of my code when connecting to mongo db
Mongodb multiply object on insertone
I am learning mongodb on node.js enviroment and when i add the same object with insertOne() function i see in compass that it’s generating new one with different _id. How to do prevent duplication in this scenario?
why cannot i learn node js and mongodb without using template engine?
i am currently learning node js and mongodb, and all the tutorials and courses i found are using template engines like ejs, why no one is teaching those two for begginers using pure frontend method (HTML & css and vanilla JS)?