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 http://dba.stackexchange.com.

0
votes
0answers
12 views

How to remove multiple references when removing many documents?

I'm removing a document from collection 'Component' to which there are references in collection 'Space'. Upon removal of document from Component, I remove the reference to that document from Space. ...
0
votes
0answers
7 views

TypeError when seeding an object referenced database in MongoDB/Mongoose

I am currently developing a web application using MongoDB and Mongoose, and I have been trying to seed the database, however I have come across an issue that I cannot seem to resolve despite anything ...
0
votes
0answers
15 views

How do I know that UpdateOneAsync failed (from UpdateResult)?

I'm trying to upsert one document into MongoDb. Pretty straightforward but what do I check (beyond the presence of an exception) to know that it failed? Code: public async Task<UpdateResult> ...
1
vote
1answer
22 views

Filter with Object child in mongo using nodejs

I have a saved a collection in my database and I want to filter it using companyId and cameras using ObjectId specific. In the follow is the collection that a want to get. { "_id": ...
0
votes
0answers
18 views

Request is not made

How can I avoid TCP 6 connections problem? I am using the method below in order to get cities information that I store on the DB, but if there are more than three objects in userFound.cities[i] the ...
0
votes
0answers
14 views

Different converters for same object in spring Data Mongo

How do I store one field as a String in one collection, and as an object in another collection I need to store an object into mongoDB with two converters. class Comment { User user; //Store it ...
0
votes
1answer
19 views

How do I filter documents based on the count of a list in MongoDB?

In MongoDB I'm looking for documents with at least 5 restaurant reviews. I've tried adding a filter on $match, such as: {"grades.score: {$gt: 4}} However this will give me documents where the ...
1
vote
3answers
27 views

how to pass id in api [duplicate]

I have problem in sending id from front to backend. this.http.get('${this.api/getOrder}/${orderId}') but it is giving garbage value. this.http.get('/api/getOrder?orderId=${orderId}') I expect this ...
0
votes
0answers
15 views

Originally fast queries with index go much slower if repeated after executing another slow queries

MongoDB, NodeJs with mongoose. I have a big database with 7.5 million documents. There is an url field and an index on it { url: 1 }. My first query is like: Scheme.find({ url: { $regex: "^google\....
0
votes
2answers
21 views

why this code is giving Reference error: db is not defined

I have already installed mongo. it is also working at this port. also contains a database test and collection student. var MongoClient = require('mongodb').MongoClient; var url ="mongodb://...
0
votes
0answers
17 views

How to connect django settings.py with mongo db?

This is my code to connect my django application with mongo db atlas. DATABASES = { 'default': { 'ENGINE': 'djongo', 'NAME': 'db_name', 'USER': username, 'PASSWORD'...
0
votes
0answers
16 views

MongoDB: remove skill from user document

So I have an issue. I have a MongoDB user document and this document has a property skills, which is an array filled with objects. What I want to do now is the following. The client sends a request ...
-1
votes
0answers
32 views

Inserting data to MondoDB

I am trying to check if data is already present in a collection. If it is not the goal is to insert some data into collection. But I face to some problems. The message in the console shows MongoError: ...
1
vote
0answers
22 views

MongoDB and Firebase not working with AWS Lambda function

I am making AWS Lex bot using lambda function and trying to connecting it to database of MongoDB Atlas using "mongoose" and database of firebase using "cloud firestore".But no data is saving to the ...
-1
votes
0answers
10 views

route.get() requires a callback function but got a [object undefined] at Route

I created an api.js file to connect to a server of a MongoDB database with port 27018 in localhost, but I got this error How to solve this problementer image description here
0
votes
0answers
5 views

Spring/Java Mongo query: How to add values of a field from multiple documents as an array while grouping/projecting

My records look like below: { domain: 'ABC', technology: 'Java', appName: 'app1', environment: 'Dev', version : '1_1', domain: 'ABC', technology: 'Java', appName: '...
0
votes
1answer
29 views

NodeJS - Protect image url to only authorized user

So I'm currently building an app. User would have the possibility to upload image. The image they upload should only be visible by them. So I'm wondering how I can achieve this considering the image ...
0
votes
0answers
15 views

Why is mongoose changing date attributes's value?

I have a Model that has a date attribute, I'm getting it's value from a post request. I have at least two problems: (1) Mongoose is accepting this input as a date : 19124-012-030 (2) When I send only ...
1
vote
0answers
31 views

C# / MongoDB Deserialization of Array of Array of Dictionaries

I am attempting to create an array of array of dictionaries in ASP.NET Core using MongoDB. In the end the data should retain this model for all uses: Model { "ContextName": "Base rates", "...
0
votes
0answers
10 views

Actual results: org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class org.springframework.data.mapping.Alias

I am trying to upgrade Mongo version to 4.0.6 but I am getting an exception: can't find a codec for class org.springframework.data.mapping.Alias. I do not know why this is. Your help is appreciated. ...
0
votes
1answer
18 views

How to perform this mongo aggregation?

I have a collection in mongo that looks like this: { "_id" : ObjectId("5c98d6f383d67f243730443b"), "date" : ISODate("2019-03-24T00:00:00Z"), "symbol" : "F:ABCD", "symbolCode" : "...
2
votes
0answers
32 views

Unable to find documents

I have a code like this: def getItems(): Future[List[Item]] = collection.find(BSONDocument.empty).cursor[Item](). collect[List](-1, Cursor.FailOnError[List[Item]]()) But it is not getting ...
0
votes
0answers
23 views

How to connect to MongoDB using NodeJS?

I cannot connect to MongoDB. This is my code: var MongoClient = require('mongodb').MongoClient,format =require('util').format; MongoClient.connect('mongodb://127.0.0.1:27017', function(err, db){ ...
1
vote
0answers
20 views

How to sort a populated two level deep subdocuments array with mongoose [duplicate]

I'm developping an api with mongoose and nodejs. Basically there is a Course Model, Student Model and Group Model. For every course there is two fields in course document: . Field "students": array ...
0
votes
0answers
9 views

Insert a new document with old information every time in mongoose [duplicate]

At a certain time interval a IoT device sends data to my backend, I want to keep a document that defines the current state of the device but I also want to see all the other states that the devices ...
0
votes
0answers
15 views

No data on database of mongoDB Atlas and firebase(cloud firestore) using AWS Lambda function [duplicate]

I am making AWS Lex bot using lambda function and trying to connecting it to database of MongoDB Atlas using "mongoose" and database of firebase using "cloud firestore".But no data is saving to the ...
0
votes
0answers
31 views

How to push array object to Nested array in Mongodb [duplicate]

Trying to insert slab array into mongodb, here is the log from client side My document is: tilte: Title slab : Array(2) 0: {lessthan: "22", value: "22"} 1: {lessthan: "22", value: "22"}...
0
votes
1answer
10 views

MongoDB dataSize command error “couldn't find valid index containing key pattern”

We have two MongoDB clusters, they do not interact with each other. We used to run dataSize command (https://docs.mongodb.com/manual/reference/command/dataSize/) to record the storage used for each ...
0
votes
0answers
11 views

Python/Flask BSON problem, how to iterate through keys and values? [duplicate]

I'm trying to get keys and values from an object in simple and clear way and store them using flask-session library, but it looks like the object is MongoDB's BSON and it doesn't work the same way ...
2
votes
0answers
35 views

mongodb query returns results at commandline, no results in C++

I query mongodb via C++. One particular query is oddly returning no results via C++ but works fine at the mongo shell (using the same credentials). I'm trying to understand why they are different ...
0
votes
0answers
15 views

Mongo $nin does not work how it should in documentation [duplicate]

I prepare query with match condition, and use $nin. I need select all document where status not equal 0,5,50,1. Maybe I'am not correct understand $nin operator. $nin - the field value is not in the ...
0
votes
0answers
17 views

MongoDB filter record by created date [duplicate]

Is it possible to filter records by created date ? The problem is, i don't have a date field. But does mongoDB keep insertion date by itself and can i filter it by specific two dates ?
0
votes
0answers
9 views

MongoDB Change Streams events: replace vs update?

I checked the document https://docs.mongodb.com/manual/reference/change-events/ I'm not sure when exactly events "replace" and "update" happen. For example, when I use MongoDB Compass to change 1 ...
0
votes
1answer
17 views

Cannot encode object: <tkinter.StringVar object> pymongo

I'm fairly new to programming and basically I have no idea what I'm doing. I'm trying to make a write simple UI that that can take an input and write it to a mongodb. import pymongo from tkinter ...
0
votes
0answers
16 views

How to fetch data greater than 24 hours in MongoDB with Aggregate? [duplicate]

I work with MongoDB and mongoosejs and I try to get data using dates I have an aggregate statement for a collection to receive all data than greater at the current time less 24 hours. , For example,,...
0
votes
0answers
24 views

how can I edit this function to find task by user and date instead of taskId [duplicate]

I am new to mongodb and I am trying to fetch data by date and user. can you help me with this ? how do i query to fetch that. here is my function : public getTaskWithID(req: Request , res:Response){ ...
0
votes
0answers
24 views

Passport Hangs when authentication user from html form login

When trying to login via the HTML5 form, passport seems to be hanging on authentication. I have a user in the database and made sure the email and password were correct. Routes var express = ...
-1
votes
0answers
18 views

Filtering nested array in using Aggregation Framework in Java + MongoDB + Springboot [duplicate]

Note: Question marked as duplicate. But reference links are not solving my purpose. I want to convert my native query exactly to Java way. I'm trying to filter out second level array inside my ...
2
votes
2answers
23 views

Match multiple criteria inside an array [duplicate]

I have the following: offers: [ {user: 'jon', price: 200, selected: false}, {user: 'ted', price: 100, selected: true} ] I am trying to do a match that will get all offer ...
3
votes
3answers
40 views

Mongoose/MongoDb FindOneAndUpdate not working as expected

I am trying to update a certain location only if its a status: 0 or status 2. Do not update if status is 1. I only have one copy of that location. Property.findOneAndUpdate({ status: 0, location: req....
0
votes
1answer
20 views

checking if your elemMatch regex conditions work

I have a MongoDB query: db.list.find({categories:{$elemMatch:{ "$regex":".*Bar.*", $not:/^Barbeque/}}}).pretty() where it looks at the elements in the categories array and I think gets all documents ...
0
votes
0answers
11 views

Mongoose Atlas connection hanging

I'm trying to abstract a tutorial for MEAN stack to use MongoAtlas rather than a local instance. My Mongoose connection to Atlas DB is working (in so far as I can connect to the DB). But I'm not able ...
0
votes
0answers
12 views

Querying array of arrays in MongoDB 4.0 for full match with $all

I have nested array in database (MongoDb 4.0) as follows: { 'data': [['John', 0.03524952621604548], ['Joe', 0.3110549589387239], ['Kevin', 0.6536955148452306]], 'date': time_stamp 'data_format': '...
0
votes
0answers
19 views

Tips on quickly and efficiently updating millions of MongoDB documents using python?

quick question about a mongodb db and collect i've setup and am trying to use python to update each of the documents. Basically I have a collection of about 2.6million postcode records and have my ...
-6
votes
0answers
45 views

Overwhelmed, need some support [on hold]

I'm currently learning Javascript/React/NodeJS, I've created a couple of simple tutorials with React but I now want to step into the bigger world of JavaScript, however I do not have a mentor/tutor ...
0
votes
0answers
22 views

How to get GridFS file using Java driver 3.7+?

I need to get the GridFS file using Java driver 3.7+. I have two collections with file in a database: photo.files and photo.chunks. The photo.chunks collection contains the binary file like: The ...
0
votes
1answer
16 views

How to connect to MongoDB Atlas using Robo 3T?

I'm trying to connect to MongoDB Atlas using Robo 3T. I must be doing something wrong, cause when i'm trying to connect I get the following error message: Failed to connect to cluster via SSL tunnel. ...
1
vote
0answers
23 views

Summing values across array elements

I have the following document: { "month": 2, "year": 2019, "categories": [ { "title": "Income", "budget": 5000, "amount": 2000, "subcategories": [ { ...
0
votes
3answers
26 views

Why validation runs on field update in mongoose?

I know that there shouldn't be any validation on field update but it runs anyway when I try to migrate a database. Part of the migration: const arr = await User.find({ ban: { $exists: true } }); ...
0
votes
0answers
15 views

How to retrieve the deleted database from mongodb two days ago [duplicate]

I have deleted one database from Mongodb. It contains lot of collection. Please provide some examples to see the deleted databases and to retrieve database

http://mssss.yulina-kosm.ru