Questions tagged [mongodb]

MongoDB is a scalable, high-performance, open source, document-oriented NoSQL database. It supports a large number of languages and application development platforms. Questions about server administration can be asked on https://dba.stackexchange.com.

Filter by
Sorted by
Tagged with
0 votes
0 answers
6 views

Strange error when try to make $push into collection of generic objects on MongoDb

I use MongoDB driver with TypeScript. I have two generic classes - Container and Item. Container has a field item of Item and array items of Item. When I try to update Container's field with $set, ...
Dyukon's user avatar
  • 1
1 vote
1 answer
45 views

Why this query works in MongoDB?

For instance, I have this JSON inject { "insert": "2023-12-08T09:49:00" } It is String I have sent this query here db.example.find({ "insert" : { "$gt" : &...
Jankiel Goldman's user avatar
0 votes
1 answer
20 views

Get document counts based on unique field values

I have a Mongoose job model, each job has a US State. I'm attempting to make 1 query that will give me back the number of jobs that are in each state. Goal would be to populate a US heat map of jobs. ...
Brant's user avatar
  • 1,766
-1 votes
0 answers
20 views

Use triggers in MongoDB with PHP

I want to add triggers so that when something changes in a specific collection I can refresh the displayed information, or show an alert to the user that the content has changed. Any ideas on how to ...
Ariadni Mak's user avatar
1 vote
0 answers
22 views

auto generate _id (mongodb) for subdocuments in mongodb with Laravel

I want to create the objectId (_id) for subdocuments automatic. I know how to generate the MongoDB objectId when data is entered in collection. But is there any way it should save automatic and ...
kanu mahajan's user avatar
-3 votes
0 answers
14 views

How to use 2 database in one project in mern stack like 2databases(mongo db , mysql ) and how to develop relationship between them? [closed]

2 databases -> mongodb and mysql how to fetch the data from both with relation. suppose one data in mongodb and another data in mysql how to fetch the data from both db with relation. i am finding ...
Vivekranjansahoo's user avatar
1 vote
1 answer
20 views

How does the sorting of a collection on an array field of MongoDB work?

I have a field in my MongoDB object. This is a DateTimeOffset so it gets saved as an array with the 0th value being the amount of ticks and the 1th value being the offset. An example : [0]=...
Iluvpresident's user avatar
0 votes
0 answers
18 views

How to repair MongoEngine CursorNotFound

In my project, the underlying Mongodb framework used is mongoengine(github_link:https://github.com/MongoEngine/mongoengine) import mongoengine as engine config = ( "mongodb://xxx:27017/xxx?...
Dylan's user avatar
  • 37
0 votes
0 answers
13 views

mongoDB, setting of required attribute of a field by async function

I run a web app on fastAPI framework in react and next.js. I'm trying to set the value of 'required' attribute of a field by calling an async function like below. This is a part of a schema. ...
Jay's user avatar
  • 1
0 votes
0 answers
29 views

Mongoose Cast to ObjectId failed for value "X_Value" (type string) at path "_id" for model "X_Model"

I am trying to update multiple records at once via id. I am getting the error below. I have ensured /weather/:id is below /weather/updateMultiple. I can't work out the issue (neither can ChatGPT). ...
Mitch8910's user avatar
  • 185
-2 votes
1 answer
16 views

Trouble connecting Mongoose to MongoDB Atlas cluster: Error EREFUSED

I'm currently working on a MERN stack project and facing an issue while attempting to connect my Mongoose to MongoDB Atlas and i already set IP address to access from anywhere so,i think it's not IP ...
Codaswin's user avatar
-2 votes
0 answers
65 views

MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017 when building nodejs app using mongo with Docker

I am working on a project using nodejs as server, mongo as database and I try to build with Docker. This is my Dockerfile: FROM node:20 WORKDIR /bundify_server COPY package*.json /...
Le Minh Quan's user avatar
0 votes
1 answer
16 views

service depend-on in the docker-compose

I have two services mongodb and api, they will be started with docker-compose. However, API service needs to wait for mongodb is ready, then start. I know I need to add depend-on, but I don't know how ...
Joe's user avatar
  • 343
0 votes
0 answers
26 views

Why am I getting a 500 status error even when successfully posting to my Mongo Database?

Im working on a personal project and am a third semester student, trying to learn web development. Im using Next.js, Node.js, React, and MongoDB. Ive managed to figure out most solutions to troubles I ...
David Prepsl's user avatar
0 votes
0 answers
5 views

How to nest navigator inside a RealmProvider?

The problem seems pretty simple. I want my ToDo screen to have access to the RealmProvider. The issue is I don't have access to the navigator in the LoginScreen when called as fallback for ...
S Roy's user avatar
  • 1
0 votes
0 answers
16 views

Installing MongoDB onto an existing Xcode project?

I am trying to run MongoDB on my Xcode app for a leaderboard. I was trying to follow this tutorial: https://www.mongodb.com/docs/atlas/app-services/tutorial/swiftui/ However, it seems like I would ...
Rebecca Sweigart's user avatar
-1 votes
0 answers
32 views

pecl install mongo 5.6 on Mac M1 causing error architecture not supported

I need to install php5.6 and the mongodb Driver on my Mac Book Air Apple M1 Ventura 13.3. I'm using: pecl install mongo or even with arch -arm64 sudo pecl install mongo its the same I'm getting error ...
Karim Mortabit's user avatar
0 votes
2 answers
51 views

Mongodb update of nested array

I have a collection: [ { users: [user2, user4] }, { users: [user1, user2, user3] }, { users: [user1, user3, user4] } ] nested property "users" cannot contain the ...
Lasse Johansen's user avatar
0 votes
0 answers
19 views

AWS Local container: how to connect to mongo db instance when invoking a lambda function?

When I try to invoke my lambda function locally it won't connect to the local mongodb instance running on the same bridge network, version: "3.4" services: lambda: build: ...
spitfiredd's user avatar
  • 2,945
-1 votes
0 answers
28 views

Is it possible to connect AWS DocumentDB to MongoDB Compass without EC2 or Cloud9?

Everything I've come across online talks about using an EC2 instance or Cloud9 when discussing how to connect to your DocumentDB cluster. I don't want to do this. First of all I don't see why ...
Cole's user avatar
  • 235
-1 votes
0 answers
17 views

how to store result of equal operation of two fields into a third field in mongodb? [closed]

I have a document stored in MongoDB in below manner. { "_id": "123", "list": [{ "uploaded" : false "num": 3, "...
Sameer's user avatar
  • 1
0 votes
1 answer
25 views

add response data from a post request to state

I'm working on an inventory management system and when I click the save button to add a new item, I want to take that response data and set state with all of the previous items, plus the newly added ...
captinthor92's user avatar
0 votes
0 answers
28 views

Fetch numeric data in string with mongodb

I would like to know how I can search for all data in mongodb in which the value is greater than or equal to 15,000, as this data is as a string and I don't know how to do this, as the gte function ...
Raf4Killer's user avatar
0 votes
1 answer
14 views

Running Mongodb community on Mac with platform linux/amd

I am trying to run a mongodb container with --platform linux/amd on a Mac M2; Command: docker run --name mongodb -d -p 27017:27017 mongodb/mongodb-community-server:latest I get the following error: ...
spitfiredd's user avatar
  • 2,945
-1 votes
0 answers
5 views

Trouble Running MERN Stack Project [closed]

I'm getting error in running MERN stack project , I'm getting several problem running this project Giving the github url of the project https://github.com/ak-hu/chat-app-mern I have done npm install ...
Paras Verma's user avatar
0 votes
0 answers
30 views

Python - How to create a method for validating data from a collection and querying for a value?

This is my working code as of now which connects to a Mongo Server and returns a data output from pymongo import MongoClient from bson.json_util import dumps, loads import urllib.parse import os from ...
1875boy's user avatar
0 votes
0 answers
16 views

elasticsearch to Mongodb migration - uuid data

I'm checking the option to migrate an index from elasticsearch to mongodb. In my Elasticsearch index, the _id of each document is generated on another service, which insert a new document to the index ...
hboss's user avatar
  • 1
0 votes
0 answers
27 views

Remove all accents from a specific field in my MongoDB

I'm using mongoDB but I have some issues with accents when I want to search data. For example, If I search "Kylian Mbappe" (without accent), I want my DB to find and return "Kylian ...
Alexandre Boucard's user avatar
1 vote
1 answer
22 views

Replace root document with array using MongoDB 4

My aggregation pipeline is a document with a single field result that contains an array, like this: [ { "result": [ { "meteoEventType": "RAIN", ...
asant-leitha's user avatar
1 vote
1 answer
43 views

Mongo Query to find documents where array element contains two specific values

Trying to create a Mongo Query, using Mongoose for my Node.js project. My Data looks similar to the sample provided below. Need help in creating a Query to find documents containing warehouse = A with ...
Srikanth Alva's user avatar
0 votes
0 answers
13 views

Email send through nodemailer In node js goes into spam in hotmail

I've configured Nodemailer to send emails in my Node.js application, and it works fine for Gmail addresses. However, emails sent to Hotmail addresses are marked as spam. I've ensured that my SPF and ...
Dilkash Mahajan's user avatar
0 votes
1 answer
24 views

userSchema.plugin is not a function

I installed passport-local-mongoose package and when I used this: const mongoose = require("mongoose"); const plm = require("passport-local-mongoose"); mongoose.connect( `...
Harish __'s user avatar
0 votes
0 answers
18 views

Async to sync decorator generates bugs

I have a fast api application that uses a mongoDB database and we use Beanie as an ODM. We like the asynchronous feature of beanie. But we want to wrap the asynchronous functions in synchronous ...
hrmb-hector's user avatar
2 votes
1 answer
43 views

Golang mongodb aggregation error : Pipeline stage specification object must contain exactly one field

I want to get the count of grouped by name in the past of one month. When I try to run the below query in golang mongo client. I get the error: error: A pipeline stage specification object must ...
wate's user avatar
  • 49
-2 votes
0 answers
41 views

Can't connect to MongoDB: TypeError: bson_1.BSON.serialize is not a function

I am trying to connect to MongoDB using Nodejs and I am using the Mongo driver version 6. import { MongoClient } from "mongodb"; const mongoClient = await MongoClient.connect(`mongodb://...
Durk's user avatar
  • 60
0 votes
1 answer
27 views

Trying to delete documents from a mongoDB collection getting an error

I have an inventory management system app that uses react for the frontend and express for the backend along with mongoDB. I have a table of products and next to each product there is a delete button. ...
captinthor92's user avatar
0 votes
1 answer
22 views

can't connect to mongoDB: TypeError: Cannot read properties of undefined (reading 'startsWith')

I'm trying to connect to MongoDB using Node.js. This is the code (Listing 13.1 from Daley et al. "Node.js, MongoDB, and Angular Web Development"): var MongoClient = require('mongodb')....
jh s's user avatar
  • 1
1 vote
2 answers
59 views

Mongoose - Accessing and removing a subdocument by _ID within an array of objects

party { _id: new ObjectId('6570d8aef19ec1c690cc8d34'), name: 'party', items: [ { name: 'Welcome to your todo list', _id: new ObjectId('6570d8aaf19ec1c690cc8d31') }, { ...
ShaRaf's user avatar
  • 13
0 votes
0 answers
27 views

Flask-SocketIO: OSError [WinError 10038] An operation was attempted on something that is not a socket

The following is the error that I'm getting OSError: [WinError 10038] An operation was attempted on something that is not a socket This error started occurring once I included MongoDB connection code ...
paul_ebin's user avatar
0 votes
0 answers
25 views

Connect to MongoDB with API public and private key instead of connection string

I am currently able to connect to my MongoDB cluster using their connection string, which lists the username and password inside the string. In my customer-facing application, rather than create a new ...
Achintya Agarwal's user avatar
0 votes
1 answer
18 views

Issue in API Calling with Routes

Can anyone solve my issue. I am working on a project where the ESP needs to call an URL and make a continuous connection using Web Socket to share the data. I made Routes for that and I used that in ...
RAUSHAN KUMAR THAKUR's user avatar
0 votes
0 answers
22 views

MERN project, too many API request, net::ERR_INSUFFICIENT_RESOURCES, TypeError: Failed to fetch

I'm working on a MERN project, I store many LEADS records in a MongoDB database. (LEADS-collection). Now, I want to update the records of the collection with a new field called domain. Updating the ...
user1953346's user avatar
0 votes
0 answers
22 views

Getting a JSON with no data between MongoDB Container and TS+Express Container

I have a RestAPI (TypeScript+Express) which connects to a MongoDB collection, if both of them are running in Docker's containers and I try to get data through an endpoint it retuns a JSON with no data,...
htamayo's user avatar
  • 335
0 votes
0 answers
23 views

Connection issues with mongodb. Half of my inserts fail with multiple errors

I have my nodejs electron application that is trying to insert records into mongodb. Half of the attempts fail, only way I have managed to use it is by putting insert request into loop and trying ...
somerandomusername's user avatar
0 votes
0 answers
10 views

I am trying to get the user by the username in the collection of users, the collections.find() always returns null for the mongodb kotlin drivers

//This is my signin routing function fun Route.signIn( userDataSource: UserDataSource, hashingService: HashingService, tokenService: TokenService, tokenConfig: TokenConfig ) { post(...
Prabhat.dev's user avatar
0 votes
1 answer
20 views

How to run init-mongo.js in the TestContainer-go

Basically, I can use docker-compose to setup mongoDB, and during creating mongoDB, I have a script init-mongo.js to create a mongo user and passord for Authentication. All works well. version: '3' ...
Joe's user avatar
  • 343
1 vote
2 answers
62 views

Retrieve JSON documents with a certain month and year in MongoDB

I am trying to retrieve some documents from a collection in my MongoDB instance. Here you are the entire collection: [ { _id: ObjectId("65708c6237b62067296a398f"), date: ISODate(&...
Eminent Emperor Penguin's user avatar
-1 votes
0 answers
12 views

Install an app on Ubuntu 18.04 from some .docker files [closed]

I have a few files with the extension .docker for an app I need to setup on Ubuntu 18.04. I have 4 .docker files one with mongo, one with nginx and the others with the app. I installed docker on ...
Dorin's user avatar
  • 1
0 votes
0 answers
38 views

Error When Connecting To Mongo Server Using IAM Role

I am using Mongoid gem in Rails with IAM session token to connect with my Atlas Cluster def logs reload_mongoid_configuration @logs ||= Log.or(attributes_condition) .where(selector)...
Hassan Anwer's user avatar
0 votes
0 answers
50 views

MongoDb C# projection fails after upgrade to V3

I have just upgraded the Linqprovider for MongoDb C#driver to V3: var clientSettings = MongoClientSettings.FromConnectionString(Configuration.GetConnectionString(MyConnectionString)); clientSettings....
johnstaveley's user avatar
  • 1,410

1
2 3 4 5
3505