All Questions
14,651
questions
1
vote
1
answer
76
views
TypeError: Cannot read properties of undefined (reading 'collection') (mongodb connection)
am trying to connect the mongodb database and i get the error as shown below
It gives me error
TypeError: Cannot read properties of undefined (reading 'collection')
at C:\Users\Joh\Desktop\...
0
votes
3
answers
51
views
TypeError: Cannot read properties of undefined (reading 'map') in react-js
import React, { useEffect, useState } from 'react';
import axios from "axios";
import './List.css';
import { toast } from "react-toastify";
const List = () => {
const url = &...
0
votes
2
answers
56
views
Using an outer Boolean variable inside a mongodb aggregation pipe line logical operator $or
I have to check a Boolean flag and base on its condition return different data result.
for example I have a collection of books and their prices, normal result of query is prices matching 10, BUT IF ...
0
votes
0
answers
47
views
MongooseServerSelectionError: connect ECONNREFUSED ::1:27017, connect ECONNREFUSED 127.0.0.1:27017
my main file
const express = require("express");
const path = require("path");;
const app = express();
const hbs = require("hbs");
require("./db/conn")
const ...
0
votes
0
answers
41
views
How to create another field in mongoDB document that filters the specified item from existing document array field
I am trying to filter items from a mongoDB document array field that are not equal to the provided value and create a new field with the filtered items using aggregation with $filter method but it is ...
1
vote
1
answer
43
views
Mongoose Virtual Field Population Problem
I have a problem with current state of my database since it started with a very old backend wrapper. (Parse Server)
So here is the problem let's say I have two different collections Users and Stores ...
0
votes
1
answer
42
views
Postman show up infinite "Sending request..." on my nodeJS MongoDB application
this is my entire code of my chatbot application
const express = require('express');
const app = express();
const MongoClient = require('mongodb').MongoClient;
const assert = require('assert');
const ...
0
votes
1
answer
43
views
Can't connect to MongoClient using Node
i made a simple program to connect to my mongoDB database
const express = require('express');
const app = express();
const MongoClient = require('mongodb').MongoClient;
const assert = require('assert')...
2
votes
1
answer
39
views
EJS Rendering Error: "allChats is not defined" Despite Data in MongoDB
I'm working on a messaging application using Node.js, Express, MongoDB, and EJS. The goal is to retrieve chat messages from MongoDB and render them using EJS. However, I'm encountering an issue where ...
0
votes
2
answers
86
views
Cannot read properties of null (reading 'collection'), this error is coming when submitting form. Unable to store data in database
in connection.js
const mongoClient=require('mongodb').MongoClient
const state={
db:null
}
module.exports.connect=function (done){
const url='mongodb://localhost:27017/'
const dbname='...
0
votes
1
answer
35
views
How to search field's in a MongoDB Schema which has Reference to another Schema?
I want to search product with its name in below DOC Schema. But the products are stored as reference to another Product Schema with _id. Below is the code -
DOC Schema
import mongoose from "...
-1
votes
0
answers
23
views
Authentication Via Auth0
I'm new to web development and currently building something that will be used for a fair number of users, I wanted to use Auth0 for the authentication, my tech stack is Node.js, Express, GraphQl, ...
0
votes
1
answer
52
views
Getting No data error on verifying Authentication using passkey using SimpleWebAuthn and Node.js and react.js
I am trying to use my passkey for login in my react.js app using node.js for backend and using MongoDB for my database.
following is my backend code:
const registerWebAuthentication = async (req, res) ...
0
votes
0
answers
47
views
JSON object uploaded successfully to MONGODB using express however console logging an error
I am recently creating a server which handles CRUD operation in expressJS , I have constructed 2 schemas namely user and note , user controllers are working as intended whereas although note ...
1
vote
2
answers
88
views
I am unable to get Mongoose Aggregate method to work
I am building an api and I wanted to use the skip and limit methods in mongoose to handle pagination.
I would like to get the total document size along with the pagination data. Initially, I made two ...