All Questions
50,511
questions
0
votes
0
answers
22
views
Error: querySrv EREFUSED _mongodb._tcp.cluster0.vzygb.mongodb.net while connecting to mongodb
I've tried everything using chatgpt and configuring it again. Creating a new project and then creating a cluster and then doing all the process again.
But this error seems to be stuck there. what is ...
0
votes
2
answers
23
views
not able to connect flutter app with node server
iam trying to connect my flutter app to a node server the flutter application has a registration screen that accepts username,password and email from users and it should be reflected to mongodb using ...
0
votes
0
answers
29
views
Nodejs mongodb insert with `_id`, but `_id` becomes empty object
I'm inserting some records with _id = new ObjectId('a string with 24 length') to a collection in mongo with nodejs.
But the result _id in mongo becomes an empty object: {}, resulting in failure in ...
-1
votes
0
answers
21
views
how to prevent duplicate keys into database with mongodb and expressjs
i am working a crude project with mongodb expressjs and pug(formerly knone as jade) i am stuck on preventing duplicate keys both on Front-end and backend.
this is what i did....
let mongoose = require(...
-1
votes
3
answers
44
views
MongoDB ECCONREFUSED when connecting to MongoDB Compass
I am trying to learn Node.JS from scratch. I am trying to connect index.js to MongoDB compass when I get the error:
MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
at ...
0
votes
1
answer
24
views
Retrieving a Single Numeric Device ID from a Mongoose Schema
How can I retrieve the deviceId as a single numeric value in my Mongoose schema and Express.js controller?
I'm using Mongoose with Express.js to save car records, and I've defined a deviceId field as ...
0
votes
1
answer
34
views
gte and lte in prisma & mongodb
The error message "Type '{ $gte: number; $lte: number; }' is not assignable to type 'number'" indicates that you are trying to assign an object with $gte and $lte properties to a variable ...
-2
votes
0
answers
22
views
How do I have to connect to MongoDB using Node.js? [closed]
(node:20264) [MONGODB DRIVER] Warning: useNewUrlParser is a deprecated option: useNewUrlParser has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version
(Use `node ...
1
vote
0
answers
37
views
Building time-bound leaderboard in Node.JS and MongoDB
We have a document for each user. We award them "oranges" (in-game points) for completing activities.
We store the points given like this:
We have their epoch time along with the oranges ...
0
votes
0
answers
39
views
Create a history table and keep track of all the updates to a document
I have a NestJS application that uses mongoose and MongoDB. I need to capture all changes/versions of this document so that I can display this as a history of the document, what changes were made by ...
-4
votes
0
answers
41
views
Angular Nodejs Incorrect Login or Password
I'm trying to figure out the best way to handle login(incorrect username or password).
When user logs in I do my authentication on server side which works the way it is suppose to, if incorrect ...
1
vote
1
answer
31
views
Mongoose _id is not working correctly for custom value instead of default value
Hay! I am working with mongoose where I have collection named tag and here is it's schema
const tagSchema = new Schema<ITag, ITagModel>(
{
_id: {
type: String,
unique: true,
...
0
votes
0
answers
12
views
Agenda (Node) defining a job with a variable name
I'm working on a rule engine in JavaScript that allows users to schedule when rules are checked. I'm using Agenda to the scheduling.
Ideally I want to define jobs with variable names so then whenever ...
1
vote
1
answer
97
views
Mongodb will not run on MacOS
I have been happily running MongoDB for years on my mac (currently sonoma 14.6.1), installing via brew, using
$ brew install mongodb-community
(and variants) in the terminal and then starting it ...
0
votes
1
answer
40
views
NestJS Mongoose Connection Error: "MongooseServerSelectionError: connect ECONNREFUSED ::1:27017" [duplicate]
I'm working on a NestJS application that connects to a MongoDB database using the Mongoose module. Everything was working fine until I encountered the following error:
[Nest] 3372 - 08/24/2024, 9:32:...
0
votes
1
answer
32
views
Mongoose Validation Error on lastUpdated Field Despite Setting It Before Save
I'm running into a bit of an issue with Mongoose in my Node.js/Express application, and I would greatly appreciate your help. The problem occurs when I try to update a Restaurant document in MongoDB. ...
0
votes
0
answers
55
views
Incompatibility node driver requirements and mongoDB maximum wire version
I am updating my ancient node application to the latest npm packages, and things are moving. The heart of my application is a link to a mongoDB instance, which holds everything together. And now I am ...
-2
votes
1
answer
48
views
How to fetch data from my mongodb database to my frontend [closed]
Please, I'm a beginner and I'm trying to run a blog site using Node... I've been trying to write a code to fetch data from my MongoDB database to my frontend using nodejs, express, ejs and mongoose ...
0
votes
1
answer
38
views
Mongoose Plugin to filter soft deleted in array docs and root docs using find() and perform soft delete on array docs and root docs [closed]
Implementing a Mongoose Plugin for Soft Delete Array docs and root docs and Filtering soft deleted Array docs and root docs.
I am developing a Mongoose plugin to handle soft deletion and filtering of ...
0
votes
0
answers
32
views
Unable to add id in URL request through req params
I want to retrieve product by id from server in mongoose but req.params.id is not working.
I replaced req.params.id with id number to see if there is any other problem but it worked fine.
Here is the ...
0
votes
1
answer
27
views
How do i query items from mongodb 2 different fields and in inside nested object
I try to query the following:
app.get("/api/leagues/:leagueId/:fixtureDate", async function (req, res) {
const result = await client.db("db").collection("matches")....
0
votes
0
answers
24
views
Pterodactyl Error while creating a server
{ object: 'user', attributes: [Object] },
{ object: 'user', attributes: [Object] },
{ object: 'user', attributes: [Object] },
],
meta: {
pagination: {
total: 25,
count: 25,
...
-1
votes
0
answers
23
views
Changing password with bcrypt [closed]
I have got some issues about bcrypt is that changing password.
Users.js
import Users from "../db/users";
import ApiError from "../errors/ApiError";
import bcrypt from "...
0
votes
1
answer
41
views
Cast to ObjectId failed for value (array) at path (pathName) because of BSONError
Not sure if i did wrong, but I'm trying to POST an array with ObjectIds into a model with the type being ObjectId (see model), and it just returns
"Cast to ObjectId failed for value "['...
7
votes
2
answers
120
views
how to efficiently carry out a priority-based $or query in mongodb with 10 billion records?
i have a mongoDdb collection of about 10 billion documents. I want to be able to search in the collection using an $or query but gives priority over the conditions.
here is my existing code :
const ...
-1
votes
1
answer
27
views
CRUD operation problems in NODEJS and MONGODB [closed]
How to prevent duplicate ID and email in mongodb, nodejsand expressjs. and stop registration. also prevent the user from registring twice. Iam just new in nodejs and mongodb i will appreciate if i can ...
0
votes
0
answers
44
views
JWT token valid in Postman but invalid in mobile app authentication
Here's a comprehensive body that incorporates the key points and potential troubleshooting steps:
I'm having trouble authenticating users in my mobile app using JWT tokens generated by a Node.js ...
0
votes
0
answers
38
views
Update a document in MongoDB with a regular expression
In a Typescript source code on Nodejs using MongoClient, I need to search for a field ("provider", declared as a string) with a regular expression and then update that field:
await ...
0
votes
0
answers
26
views
How do I programmatically access Mongo Atlas cluster "logical size", current & max
I'm just trying to keep the database capacity visible in the client app I'm making, because it's not for me, so of course I want the user to see their database consumption, so we can talk about ...
0
votes
1
answer
63
views
Endpoints working but views are not loading why?
This is a file sharing system made with mainly nodejs,express,bootstrap and mongodb. i tried creating th eregister page and it was working but i changed the logic now it's just not working and i don't ...
-1
votes
3
answers
51
views
Mongoose findOne always return null
This is the user snippet
const mongoose = require('mongoose');
const userSchema = new mongoose.Schema({
name: { type: String, required: true },
lastName: { type: String, required: true },
...
0
votes
0
answers
52
views
Rendering and sending data to EJS template
I am a newbie NodeJS developer and I am trying to fetch data from MongoDB and render it to another .ejs file to display it. But error showing that data is not defined in the line <% data.forEach(...
0
votes
1
answer
31
views
Having an issue with formatting
I am following this guide to learn how to develop a p2p messaging application. the guide seems out of date and i have having trouble displaying 2 things properly
<TabsTrigger value="login"...
2
votes
0
answers
78
views
Handling null value in response, using axios and mongoose schema
When doing getOrder, it returns a response of user:null. Because of this, my database is full of orders without user names. What I want is to display the user's _id in the newly created order when ...
0
votes
0
answers
37
views
$gte for dates works in MongoDB Atlas, but not in Mongoose
I'm trying to query for products that are still on sale using this schema and filter:
// Model
const ProductSchema = new Schema({
sale: {
until: Schema.Types.Date
}
})
const Products = model('...
0
votes
1
answer
48
views
How to add methods to query an object in mongoose using typescript?
The problem is more related to the typescript. I need these methods to check the returned result after querying the db.
const user = await User.findOne({idUser: 1}).isAbsent(400)// this status code ...
0
votes
0
answers
34
views
Populate a ObjectId deep nested inside arrays and objects preserving document shape
I'm using MongoDB v5 with NodeJS (no Mongoose).
Let's say I have a collection structured the following way. This specific setup (an ObjectId nested inside an object contained inside an array contained ...
0
votes
0
answers
36
views
Image is not getting displayed from the MongoDB in the React website
I have built a website like a blog post. The image is being uploaded to MongoDB and has not been displayed on the website. I have checked whether the image is rendered using Postman; the image has ...
1
vote
1
answer
36
views
server-side request cant access token. token undefined error
This section code must read the token and approve the login process. But it can`t read tokens from my cookie.
app.get("/get-token", (req, res) => {
// Get the access token from ...
0
votes
0
answers
32
views
DiscordAPIError[10062]: Unknown interaction randomly popped up
I'm trying to make a discord bot. for a skyblock server, using the commands it will show for example farming level, etc. this code use to work just fine, the next day when I started it I got this ...
-1
votes
0
answers
12
views
SocketException: OS Error: Connection refused, errno = 111 in flutter using Node Js / Mongo backend
Please help me with this issue..there is issue with the retrive the image from mongo using node js and mongo
//import '../../../core/data/data_provider.dart';
import 'package:flutter/material.dart';
...
0
votes
0
answers
23
views
Gcloud node deployment - gcloud app deploy with latest node version
I was using nodejs 16 for my gcloud node application.
Now I am getting warning and unable to deploy nodejs app to gcloud.
I am trying to re-upload with latest nodejs version.
This is my cloudbuild....
0
votes
0
answers
30
views
GET request to `getOne` controller. Postman returns no data from MongoDB and causes endless request loop
sample data and postman req image I am sending "get" request on Postman. Using Express. Unfortunately, there is no luck and I can't find the mistake. Here is my factory.js :
exports.getOne = ...
1
vote
0
answers
43
views
Get all records in a mongo collection returns empty array
I have a mongo database named "photos-album", and a collection named "users".
I'm trying to fetch all users in mongo, but I get empty array although I do have users in my users ...
1
vote
0
answers
37
views
How to handle : Error : image: Cast to string failed for value; NodeJS
So I'm working on expressJs and mongoosh connecting server to DataBase. For inserting documents I've created different file "data.js" and require this data.js to index.js.Mainly error is ...
1
vote
1
answer
35
views
BSONTypeError: Unsupported type BigInt, please use Decimal128
I'm trying to create a sort of timer command with Discord.js and MongoDB. I currently use mongoose as the wrapper. I am also using Agenda to automatically delete the timers from the database after the ...
0
votes
0
answers
43
views
How can I resolve an invalid token in js
I am trying to resolve the error. When I verify my touch it marks it as invalid and my req.user as defined
index.js(this is my file)
const express = require('express');
const mongoose = require('...
0
votes
1
answer
40
views
Express-session and JWT token disappearing across different ports in MERN stack
I am working on a MERN stack application with the following structure:
myReactApp
--/frontend (React app)
--/dashboard (React app)
--/backend (Express server)
I have implemented user authentication ...
0
votes
1
answer
34
views
Difficulty using mongoose-paginate-v2 for pagination in TypeScript
I'm encountering issues with pagination using mongoose-paginate-v2 in my TypeScript application. When I attempt to paginate my OfflineMacroAction collection, I'm not receiving any results despite ...
4
votes
0
answers
44
views
Issue with MongoDB Query Using $ne: null on Array Fields
Context
We are working with MongoDB queries in a Node.js application, where we need to filter documents based on whether an array field (specifically, a field within a nested array) exists and is not ...