Category "mongodb"

Query over a field which is deep inside MongoDB collection using array of possible options

I have a list of commentDocument collection in MongoDB where each has the following structure: { "commentName": "test comment", "outputs": { "ex

Why can't I connect to mongoDB atlas?

I am new in MongoDB, all my life I used MySQL. I have created an account in atlas, set the IP to my IP and created a user and saved the password. here is my cod

How to query Child Reference Pattern collection with $graphLookup

I have a collection with child reference. Each document can have multiple parents. How can I query it with $graphLookup in order to make a result prepared for a

How to upload a single image file with next.js to mongodb?

When I'm uploading form data to mongodb, in the image section it shows this: "C:\fakepath\imageName.jpg" with no actual image in it. And when I fetch the data f

MongoStore.create({ ..............Cannot read property 'create' of undefined

I have tried every possible step I've come across but the problem doesn't resolve. The error shows: C:\Users\...............\server.js:35 store: MongoStore.crea

Is there a way to avoid stringValue Favicon.ico error in express js

I am trying to build an application in my Express and anytime i navigate to the admin page i get this error const castError = new CastError();

Access root document map in the $filter aggregation (MongoDb)

I apologize for the vague question description, but I have quite a complex question regarding filtration in MongoDB aggregations. Please, see my data schema to

MongoSQLd not starting on Windows

I'm very new user of Mongo and I'm trying to enable MongoDB connector for BI. I want to change my connect address, but it only connects to 127.0.0.1... I made a

How to delete and insert with a single command in mongoDB?

So, I have a collection like this: [{ "name":String, "address":String, "hobby":Array of Strings }...] Every hour I query an API and get the response l

how to replaceOne document in MongoDb with Mongo database command

We have requirement to execute replaceOne operation with db.runCommand() I checked list of commands from here, but i haven't found any command to replace one do

Storing sessions with express-session, connect-mongo, and mongoose

I am looking for guidance on setting up session based authentication with with Express-Session, connect-mongo, and Mongoose. Currently it's just generating a ne

MongoDB - query references 2 deep of ObjectIDs

I've inherited a Azure Cosmos database with a MongoDB API. There is extensive use of "discriminators" so a single collection has many different models. I am try

Slow query using aggregation framework mongodb

I came up with this code to query a list of questions from db question .aggregate([ { $lookup: { from: "answers", localFie

How to fix " Path is required ,ValidationError " ,Mongoose ,node

I have searched everywhere for this problem. but I cant find the correct way to fix it. help me to what is the problem. const router = require("express").Ro

Specifying a port in MongoDB URI does not allow me to connect to my local DB

I am testing a connection to a local DB using mongoose and mongodb. Whenever I specify a port when passing in the URI to mongoose.connect() I get a connection r

When working with the native mongoDB driver, Node.js and hyper terminal, I receive an error saying "TypeError: Cannot read property 'n' of undefined"

I am using vs-code, hyper-terminal (Git Bash), JavaScript, Node.js, Express, MongoDB and its native driver but while I finished up writing my code, I wrote node

Querying Views with Mongoose (and encapsulating documents fields)

I use mongodb views to encapsulate data in a Data Transfer Object. After the first run of the code below the view is created in the database. Subsequent executi

Querying Views with Mongoose (and encapsulating documents fields)

I use mongodb views to encapsulate data in a Data Transfer Object. After the first run of the code below the view is created in the database. Subsequent executi

What is the difference between mongod and Service of mongodb run in windows services

Recently I started learning Mongodb. After the installation I ran the > mongo command and without starting the daemon ie the mongod and even without starting

Cannot read properties of undefined (reading 'path') - Multer Error

I am uploading an image to a folder in uploads via multer package. I am getting an error while testing the route in POSTMAN. location_model.js const util = requ