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.

0
votes
0answers
7 views

Model.find({}) query using mongoose with node.js and express combination fails to fetch large amount of datasets of more than 200,000+ documents

I am using a simple get request using mongoose coupled with express and node to fetch all the documents in a particular collection I have defined in a MongoDB instance. It works fine for small amounts ...
0
votes
0answers
4 views

Get backup from mongoDB, while one of index-*.wt files is missing

I have deleted one of index-*.wt files called "index-0--6343185395173617924.wt" by mistake and I get "Topology was destroyed" error when I try to write some data in some collections. I have tried to ...
0
votes
0answers
9 views

Composite Primary Key using MongoDB and Spring Data JPA

Could someone tell how to create a composite key in Spring Data JPA using Mongo DB
0
votes
0answers
5 views

Unable to connect php with mongodb atlas

I try to connect PHP with Mongodb atlas but failed. The mongodb atlas connection string is "mongodb+srv://username:[email protected]/test?retryWrites=true&w=majority" I tried ...
0
votes
0answers
11 views

In MongoDB, get all documents min values from the collection of subdocuments and the the subdocument name/id

I apologise if it is duplicated. I have a collection like this: { game_name:"ABC", ..., prices:[ {area: 'US', price_usd: 10}, {area: 'AU', price_usd: 11}, ... ] }, ... I can get: ...
0
votes
0answers
6 views

Mongodb cluster sudden crashes with read / write concern queries

We have a mongodb cluster with 5 PSA replica sets and one sharded collection. About 3,5 TB of data, 2 billion docs on primaries. Average insert rate: 300rps. Average select rate: 1000rps. Mongodb ...
0
votes
0answers
9 views

How to improve query speed in mongodb?

I have a database using mongodb and it has around 1 millions documents and growing. I use it to keep ping logs. As it keeps growing, now query takes a long time. below are my query (I'm using pymongo)...
0
votes
0answers
12 views

Bottle & MongoDB not posting to database

I am attempting to use curl to write JSON values via my bottle server to my mongodb database. I am getting "POST /create HTTP/1.1" 200 0 which seems to indicate success, but when I attempt a .find() ...
0
votes
0answers
10 views

Find objects of near locations using mongodb | all nearby location A to all nearby location B

Hey MongoDB experts I am trying to achieve some query results using MongoDB various location features ($near, $geoNear and more). I have this mongoose model with geoJSON type. const geoSchema = ...
0
votes
0answers
17 views

Mongodb empty find({}) query taking long time to return docs

I have ~19,000 docs in an mlab sandbox, total size ~160mb. I will have queries that may want a heavily filtered subset of those docs, or completely unfiltered. In all cases, the information I need ...
0
votes
0answers
15 views

How to update BsonArray values in a BsonDocument with C#?

I save objects into MongoDB documents having a structure with several nested documents and arrays containing documents. Considering I make some updates into these objects, I want to push them into ...
0
votes
0answers
8 views

Not able to render data fetched from mongodb atlas in redux using axios with componentDidMount

I got problems in rendering documents fetching (axios) from Mongodb Atlas by redux. I used componentDidMount to solve the asynchronous time from fetching and store but it shows the error at "let ...
0
votes
1answer
16 views

Mongoose Insert Many Heap Out of Memory

I am trying to run a mongoose insert many command with an array that contains about 145,000 JSON objects. I ran this command locally on my mac test environment and it doesn't crash however, when i run ...
0
votes
0answers
10 views

How I can upload file text to mongo (I use nodeJS +express) from Front end (React)

I can't upload to mongo text from a file which I sent from Front end to server (NodeJS). I send sample_movies.txt file only. Maybe somebody can help me. Thank you so much. MY CODE IN FRONT END : ...
0
votes
0answers
14 views

Auth with JWT Using Node and React

So im trying to implement a sigin/login logic with node and react using mongo as a database. Sigin is fine, i sign an user and it gets stored on the db with a token on browser. Then i get redirected ...
0
votes
0answers
20 views

Why can't I access my mongodb running in a docker container in Azure web apps?

I want to run a mongodb docker image from dockerhub for example mongo:3.6 or mongo:4.1 in an Azure Web App but I can't access it from outside. According to the Azure logs the docker container starts ...
0
votes
0answers
9 views

mongo model fields not showing up in graphiql UI

I am creating a project to query a mongo schema in GraphQL. I have a model which act as a mongo collection and schema file for mapping the model with graphql Query. When i try to query the fields in ...
0
votes
1answer
23 views

How to fix unhandled promise rejection warning, cast to objectid failed

I'm new to mongoose, I am trying to set up a get route to '/featured' in my api but am getting the following error '(node:8989) UnhandledPromiseRejectionWarning: CastError: Cast to ObjectId failed for ...
0
votes
0answers
12 views

How to avoid user validation when updating user field in moongose schema?

I have two Schemas, User and Post. When I add a post I want in User Schema to add a reference to that post. Problem is that I use pre-save hooks for validation and it does not allow me to save posts ...
0
votes
0answers
10 views

MongoDB text index over multiple languages

I created a text index in MongoDB. The index contains text translated into multiple languages. I would like the user to be able to search across all translations. I studied the docs but ended up ...
0
votes
1answer
17 views

Why is Spring Boot Starter Mongodb Reactive not saving the List fields of my entities?

I can't figure out why the List fields of my entities are not being persisted when saved using Spring Boot Mongodb Reactive. This is how my Contact entity looks like: @Data @Document public class ...
0
votes
1answer
26 views

Mongoose schema array of objects

I have big object like this: const example = { startMap: 'Something', monsters: [], monstersToOmit: [], mapsOrder: [1, 2], mapsData: [ { id: 1, ...
1
vote
1answer
15 views

Live reload on Database update

Previously I worked on Meteor and MongoDB. when I was working on it I noticed that Meteor server reloads the data if any changes happen in Mongo DB. Can we do these things in Spring Boot, Java? I ...
0
votes
1answer
18 views

How to make embedded queries with many to many relations in mongodb

I have these relations: https://pastebin.com/hMZRJe0S and I need to get the ui given the user using java script I tried to get the id of usuario, then the ids of rol, then the ids of funcion and ...
-1
votes
1answer
23 views

how i can check if my input field contains HTML tags and how to eliminate it for security reasons

I use express-validator and I need to check if my input fields contain HTML tags to eliminate it from the string. can express-validator help me with it or there is module I can use it instead thank ...
1
vote
1answer
30 views

How to check if an element exists in a document and return true or false depending on it?

I have an aggregation query in which I use $lookup to get data from other collections. But I cannot understand how do I get a boolean value if a $match is found. Schema const likesSchema = ...
0
votes
1answer
22 views

mongodb config file not found on dockerized mongodb

First of all there, I know would be easier ways to solve my problem but in order to get a better understanding of docker, this is the way I want to solve running a dockerized mongodb. I am right now ...
1
vote
0answers
17 views

React-Leaflet app suddently stopped working Uncaught TypeError: Cannot read property 'lat' of null

Need your help! The problem is that my app suddently stopped working. It did showed markers previously.But now I see this "Uncaught TypeError: Cannot read property 'lat' of null" It is very strange ...
0
votes
0answers
17 views

Querying MongoDB records over last 24 hours in PHP

I'm trying to query for MongoDB records that were created over the last 24 hours (the $hours variable allows for flexibility). Below is the PHP code I have for the time filtering condition: $...
0
votes
1answer
19 views

How to access the second level array in mongodb (with group)

here is sample collection: { "_id":ObjectId("5cc7d8e88c33e065c56b0883"), "age":70, "child":[ { "id":"son1", "age":40, "grandSon":[ ...
0
votes
0answers
22 views

How to find a collection by its content [duplicate]

ive been trying to find a collection without knowing its name, but by one of its parameters. I tried this : MongoClient.connect(url, function(err, db) { if (err) throw err; ...
0
votes
0answers
10 views

Firebase sends a JWT token after logging in. How to get Signing key for the token to verify JWT in MongoDB Stitch?

I'm trying to use MongoDB Stitch Custom Authentication to verify a JWT generated from Firebase auth. I'm getting the following problem when connecting to MongoDB: error: "crypto/rsa: verification ...
0
votes
0answers
17 views

How can I get data out from mongb using GET method by giving input? using django

I am trying to loop through mongodb using django and get the output by entering input. I want to enter one value by request and loop the data in mongo db, if the entered value exists in mongo db ...
1
vote
0answers
26 views

mongoDB query modifiers check

i have this code that i want to fetch data from mongoDB with query modifiers such as the 'limit' and 'Orders' let data; if (obj.search && obj.sortBy && obj.limit){ ...
0
votes
1answer
24 views

Access to previous document in MongoDB aggregation result

The question is how I can refer to the previous document from the result set? I have an aggregation with such result: var result = db.collection.aggregate([...]) { "_id" : "2018-01", "month" ...
0
votes
0answers
18 views

How would I search for emoji using text search in MongoDB

I'm trying to search for emoji in a text indexed collection but it can't handle it. When I'm searching for the term 'cancer' db.getCollection('my_collection').find( { "$text" : { "$search" : "...
0
votes
0answers
16 views

merging two stages of mongodb aggregation pipeline

I have a series of prices like below in a mongodb collection: id date value A 1 Jan 18 1 A 2 Jan 18 0 A 3 Jan 18 0 B 14 Jan 18 4 B 15 Jan 18 5 B 16 Jan 18 0 C 2 Jan 18 4 C 3 ...
0
votes
0answers
16 views

Schema.save() not working to save schema to database

Trying to save a schema object to the database after adding an object to an array of object and then trying to save it Models are :- InternshipProfile.js https://raw.githubusercontent.com/...
0
votes
0answers
10 views

Djongo or MongoEngine to deal with mongodb for Django web app?

I am writing backend code for a web app, the database is already in MongoDB, what is the best way to use MongoDB with Django is it djongo or mongoengine? I found mongoengine a bit complicated and ...
0
votes
1answer
29 views

How to find count null fields for all keys in document in MongoDB?

I have a collection in mongo with multiple fields, I need to find out number of null values for each field in all documents? Also I need to do it using aggregation pipelines. For Example if my ...
0
votes
0answers
23 views

How to send firebase push notification from node server

I am using nodeJS and mongodb as a backend service in my android app and using FCM for sending push notifications to users. To achieve this I am saving firebase registration token on MongoDb. I want ...
1
vote
1answer
27 views

mongoose sort document by populated field with conditions

i have two schema vehicle schema : const VehicleSchema = new Schema({ title: { type: String, required: true }, price: { type: Number, required: true }, ); VehicleSchema.virtual('...
-1
votes
0answers
13 views

How to use spring data mongo to query value from list of obejcts inside a embedded object

I have below object structure. public class EmployeeInfo implements Serializable { private static final long serialVersionUID = 1060791921216076800L; @Id private EmployeeKey employeeKey; ...
-1
votes
0answers
16 views

My function for zipping 2 lists and adding to database is going slow. Can someone tell me why my code takes a while to process?

my line of code is going by slow but i dont know if it's because of the css selector. any ideas? IList<IWebElement> elementList = driver.FindElements(By.LinkText(varName));
1
vote
2answers
42 views

Best way to send a mass amount of text reminders using AWS?

I am trying to send a massive amount text message reminders that are stored in a MongoDB database that need to be sent at a certain time down to the minute (they will be sent using AWS). The current ...
0
votes
0answers
23 views

$elemMatch in @Qeury

I have a document with an array containing DBRefs. Here is the structure: { "_id" : ObjectId("5d05a1eab7eb3b4ec8a0af54"), "participants" : [ DBRef("users", ObjectId("5d05a1eab7eb3b4ec8a0af38")...
0
votes
0answers
21 views

How can I zip 2 lists (key list and value list) together and insert into a mongoDB collection? c#

I have 2 lists that I want to zip together and then insert into a database. I have the following code but I'm not quite sure what's wrong with it. MongoClient dbClient = new MongoClient("...
0
votes
1answer
20 views

Checking if field inside collection exists

I'd like to check if a value inside a field of a collection doesn't exist. I tried both ways. Once checking if it does exist, that worked out fine, as far as I can tell: if (Characters.findOne({...
0
votes
0answers
17 views

Can't bind to public ip MongoDB

I am trying to bind to my public IP. However when editing the contents in nano /etc/mongod.conf It does not work. Now I think this might be the issue. Running ifconfig only shows my private ip address:...
0
votes
0answers
23 views

Passing configuration files to the docker container on bitbucket pipelines

I want to have a service with pre-configured mongodb on bitbucket pipelines. The problem is that mongodb must be configured with TSL/SSL authentication, which requires .pem files with certificate and ...