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
3 views

Upload and fetch images using Node and Express server

I'm building a website where users can upload images as a information to server and the admin responds accordingly. Which tools/modules I need to use and what's the overall process if I'm using Node ...
0
votes
0answers
3 views

Update mongodb field value only if new providerId not exists

I have the following document in mongodb. { "_id" : ObjectId("5ce34ac6a2f25b2448b9b3a3"), "userId" : ObjectId("5ce34ac6a2f25b2448b9b3a0"), "providers" : [ "1689736266", "...
0
votes
0answers
10 views

NodeJS sharding architecture with many MondoDB databases approaches

We have architecture problem on our project. This project requires sharding, as soon as we need almost unlimited scalability for the part of services. Сurrently we use Node.js + MongoDb (Mongoose) and ...
-2
votes
1answer
9 views

MEAN stack: How to store user credentials in mongoDB

In an online platform built with the MEAN stack, where there is more data attached to the user (e.g.: a game where users have points, coins, medals, presents, and so on): Is it advised to have a ...
0
votes
0answers
5 views

Mongodb-Update field with string and value of field (concatenate)

I run an update query on mongodb in order to replace all the array elements ' values (now integers) with string, that will include text and the integer value(transformed into string) The JSON ...
0
votes
0answers
9 views

Performant way of getting count of records with a certain value

I have two collections, people and actions, that are connected 1:n, so every person can have a lot of actions. I am looking for a performant way of getting the number of people that have specific ...
0
votes
0answers
17 views

text search for numbers field is not working [on hold]

$text search for numbers field is not working in MongoDb db.user.insert({"name":"Guna krish","email":'guna...@gmail.com',"phoneNo":"9874561230"}); db.user.ensureIndex({ "$**": "text" },{ name: "...
0
votes
0answers
6 views

How to use $AND operator to joins more than two collection using Aggregation Framework with spring-boot (java)?

want to connect more than two collection using lookup(aggregation) with spring-boot java and also need to apply AND condition between those joins.
0
votes
0answers
6 views

ACL documental database

This is much a conceptual question than other. I'm wondering if there is any best practice and where can I read about it, also don't know how to ask it to google. I'm working into modeling a mongodb ...
0
votes
0answers
9 views

Importing nested JSON documents into Elasticsearch and making them searchable

We have MongoDB-collection which we want to import to Elasticsearch (for now as a one-off effort). For this end, we have exported the collection with monogexport. It is a huge JSON file with entries ...
0
votes
0answers
12 views

Return aggregated nested Document in Java Spring boot Mongodb

I'm working on a Java Spring Mongodb project and I have a class (mongodb document) 'Measurement'. @Document public class Measurement { @Id private String id; //@DBRef @JsonIgnore ...
-1
votes
0answers
11 views

Threaded comment system with mongodb nodejs and angular

I want to make a threaded system for comments in MEAN stack but don't know which approach to follow so as to make it work perfectly on both backend and frontend.
0
votes
0answers
10 views

How to configure Mongodb connection within kubernetes to connect with my nodejs app

I create an nodejs app and try to connect it with mongodb on kubernetes cluster. The nodejs and mongodb app are separate pods in my cluster. mongodb and app are running when i display the status , i ...
0
votes
1answer
11 views

Mongoose model.find(filteredQuery) returns empty array

I have a Node.js back-end that communicates with my MongoDB, and I need to filter out some results from the database. The problem is, when I send the query, I just receive an empty array in return. ...
0
votes
0answers
9 views

How to find errors related to mongodb

"We are maintaining two instances lets name it x and y,a module in the application code perfectly working in x but not in instance-y although it contains same code except database" So I moved my db ...
0
votes
1answer
23 views

Why can't the python code reach the else statement? [duplicate]

The program search on username and password in the mongodb. If i try with the correct credentials, the code comes in the if statement. If i try to login with bad credentials the code didn't reach the ...
0
votes
0answers
17 views

Send Data to frontend(Angular) when changes are detected in Database(MongoDb)

I'm developing a MEAN.js APP So as far as i know MongoDB is not a realtime database but using change Stream and watch we can detect changes in database So what i managed to do is to detect when ...
0
votes
0answers
16 views

Data structures being used in MongoDB (B-Trees etc)

Assume I am going to insert the following 5 elements in a Mongo db: {id= 1, name=Bob, age=34} {id= 2, name=Jane, age=22} {id= 3, name=Mike, age=44} {id= 4, name=Sam, age=55} {id= 5, name=Joe, age=21} ...
1
vote
0answers
41 views

Updating mongodb field of object type based on category

I have the following document in my mongodb collection. { "_id" : ObjectId("5ce34ac6a2f25b2448b9b3a3"), "userId" : ObjectId("5ce34ac6a2f25b2448b9b3a0"), "providers" : [ "...
0
votes
1answer
12 views

How to create a Mongodb docker container without volume

I need to create a "snapshot" of a MongoDB in a specific state without volume, for auto-testing proposes. To be clear, I need all of the data saved on the container memory and persist, not using a ...
0
votes
0answers
9 views

Troubles with enabling authorizated access to MongoDB

I'm trying to enable authorizated access to my MongoDB database. I'm using Windows 10 OS. I'm going to describe to you what I've done already. I connected to mongodb and activate collection called "...
-1
votes
0answers
12 views

Can json store benefit from same structure/schema of stored json files?

Does any from json storage (mongodb/postgresql/mysql/…) store json fies more effectively if they are of the same schema/structure? Or is it more effective to store them in relational model and create ...
3
votes
2answers
34 views

Docker-Compose: Unable to connect NodeJS with Mongo & Redis [Connection Refused]

I am working with 3 Services: api-knotain [main api service] api-mongo [mongo db for api service] api-redis [redis for api service] The Dockerfile for api-knotain looks as follows FROM node:latest #...
0
votes
1answer
23 views

How to build a nested MongoDB query in java?

I am trying to translate a working Mongo Shell query to java, but it seems like I have ran into a wall. I am using the mongo-java-driver:3.9.1. The shell query looks like this: db.getCollection('xyz')...
0
votes
1answer
23 views

Find Sum/Average of values saved with type System.Decimal in mongodb

I want to find min, max, sum and average of some data in my collection. The field, I want to perform these operations on, is stored in the document like this: I run the following query db....
0
votes
0answers
11 views

GridFS + NodeJS Retrieve image from mongoDB and display in html

I have the following JSON from mongoDB with images but I don't know how to display it: fs.chunks: { "_id" : ObjectId("542e684a8a1cec178a172673"), "n" : 1, "data" : BinData(0,"...
2
votes
1answer
20 views

MongoDB aggregating multiple objects

I'm trying to create a MongoDB query where I get a conversation between two users. Basically my conversation object is like the following: { "_id" : ObjectId("123"), "from" : ObjectId("456"), ...
0
votes
1answer
19 views

Redux mongo db editing item list

I have a .map of a list of items in a MongoDB. In my List component I have a Link to Edit view and I pass props for the id (this is working fine) const List = props => { return ( <...
0
votes
0answers
17 views

MongoDB aggregation - distance sort inside aggregation pipeline

I need to perform search by text and return results sorted by distance. The first solution was to perform $geoNear query and than to perform a $match to get needed results. This solution is way ...
0
votes
0answers
11 views

How to use $nearSphere inside an $or operator somehow

I have a User collection in which I save data related to some service providers. The service providers can save their address ("Point") and define a radius ("Polygon") in which they're active around ...
0
votes
1answer
34 views

How to union or group 2 already grouped results in mongodb like union of 2 CTE queries in SQL? How to get cumulative sum from two group by queries?

I have a collection like this [ { "forecast_yy_mm": "18-01", "actual_yy_mm": "18-01", "value": 1, }, { "forecast_yy_mm": "18-01", "actual_yy_mm": "...
0
votes
0answers
25 views

Query for Joining two collection in mongo from one array filed of primary collection

I have two collections, one is subsegments as below: [ { "_id": "5c8b2931ff2fa8129c8f666f", "segments": [ "5c8b2915ff2fa8129c8f666d" ], "isSchool": false, "isActive": ...
-2
votes
2answers
24 views

Is there any database model having these “no-sql”, “schema free” & “relational” ? is it support c++?

I need schema free db with relational features for my C++ application. I already using PostgreSQL and Mysql in my project. I want to store data relationally in document and need CRUD using SQL.
0
votes
4answers
46 views

why find object is not iterable?

I want to crawl the data site. But something wrong in my code I want to find why find object is wrong and search in stack overflow but i can't find what's wrong in this code from bs4 import ...
0
votes
0answers
9 views

Query embedded documents with mongo engine

so I'm using mongoengine to query embedded documents. schema: project class _StatusFields(mongoengine.EmbeddedDocument): start_time = mongoengine.DateTimeField() class _Status(mongoengine....
0
votes
0answers
15 views

WriteConflict occurs during commitTransaction

2019-05-13T19:01:30.473+0700 I COMMAND [conn10179] command admin.$cmd appName: "XXX" command: commitTransaction { commitTransaction: 1, lsid: { id: UUID("4d66cc5b-70ff-4f08-9eae-d281b87b59c4") }, ...
0
votes
0answers
27 views

I have a problem with adding documents to my DB. I have the code and the exception that occur during the process

I have a project about Spring boot. My teammates and I choose to use Mongodb as our DB (after we used H2). now when I tried to connect to the Mongo I can see that it connected successfully but when ...
0
votes
0answers
12 views

How do I link a group of ids that have already been iterated in one mongoose Schema then connect it to a related property in another Schema?

I'm trying to find a connect the inventory_id in the CartItemSchema to the _id in InventoryItemSchema. I already have the Id's I want from the first schema. How do I use those id's to get the other ...
0
votes
1answer
23 views

Spring Data Mongodb Connection Pool Concurrent Requests Limit

I want to know how spring data mongodb connection pool works. Imagine a spring boot rest api server connected to mongodb via spring data mongodb. If the default connection pool size is 100, does it ...
1
vote
0answers
25 views

Populate one path of an object nested inside array for specific fileds

My Posts Schema has a "comments" array path, for each "comment", "user" is objectId to User Modal. How could I populate only "name", "_id", "thumbnailURI" for the user. what the posts db looks like: ...
2
votes
2answers
19 views

Get values as array of elements after $lookup

For MongoDB, when using $lookup to query more than one collection, is it possible to get a values-only list for a field returned in the $lookup? What I don't want is a list of the full object with ...
0
votes
1answer
32 views

MongoDB: unknown operator $and [duplicate]

I am working with pymongo. I want to return the field _id for all the tuples that have the field status different from 0 and different from 1. return [entry['_id'] for entry in mytable.find( ...
0
votes
1answer
18 views

how to read back result when using mongodb transaction?

All mongodb transaction examples I have seen so far don't allow reading results back. For example (pseudo code): begin_transaction collection_one.update(...) collection_two.update(...) ...
0
votes
0answers
42 views

FileNotFoundError with pandas despite correct relative filepath

I'm trying to read a csv file in a sibling directory into a Pandas DataFrame. The filepath of my csv file is stored as metadata in a MongoDB collection, which I'm accessing via pymongo. I able to ...
0
votes
1answer
15 views

Mongoose not ignoring space in regex?

I want to do simple regex search, but for some reason following query returns nothing Assessment.find({"name": { $regex: /.*Chris Baker.*/, $options: "si" } }) while direct in mongodb console ...
0
votes
0answers
14 views

Why am I getting a 401 Unauthorized Error when hitting my protected endpoint at /api/protected?

I am using JWT to generate a token for access control. I can hit /api/auth/login and get back the token, however, when attempting to hit /api/protected with a GET request, I get 401 Unauthorized. I'...
1
vote
1answer
22 views

How can I import records in MongoDb with relationship between collections?

I need to import data using a .json file, in the record I want to insert there is the relationship with Blog and Tag, to insert DBRef into the blog and tag fields I'm doing this way: {"_id":null,"...
0
votes
0answers
17 views

Can IndexOptionsConflict be avoided to change expiredAfterSeconds in MongoDB index?

I can create an index with expiredAfterSecconds this way in the mongo shell: db.x.createIndex( { "createdAt": 1 }, { expireAfterSeconds: 3600 } ) I can re-do the same command and that's ok for mongo:...
-1
votes
0answers
18 views

How to access sub-document in mongodb in springboot program [on hold]

Given below is my collection of MongoDB Database. Suppose I am using MongoDB database: test and Collection: colltest. Now in Java Spring-Boot program I want to fetch data from this collection. ...
0
votes
0answers
19 views

My react native app logouts on every refresh in feathersjs

I am using react native with feathersjs and having issue of being logout after every refresh on app after some changes. const client = feathers(); options = { header: 'Authorization', // the ...

http://mssss.yulina-kosm.ru