Newest 'mongodb' Questions - Stack Overflow

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

SyntaxError: missing ; before statement @(shell):1:5

I'm learning MongoDB (on MacOS using its terminal). After downloading Mongo and running MongoDB with Mongo Shell, I try to grab data and import them in Mongo Shell using the following two commands ...
0
votes
0answers
8 views

What is the recommended way to save image data from a puppeteer screenshot?

I am in the process of making an application for plotting running routes on a map and saving them to a mongodb database. Currently, I am using puppeteer to visit a route in my application and ...
0
votes
1answer
25 views

Java Spring Rest Call to get subclass using superclass

I am trying to store multiple similar documents in the same document store (MongoDB) that is all classes that extend Foo are stored in the Foo Collection. I have a rest endpoint called findById ...
2
votes
2answers
22 views

Forward $match answer from one collection to another $match in Mongo

Background I have a mongo collection tags: ... { "_id" : 901, "tagkey" : "color", "tagvalue" : "black" } { "_id" : 902, "tagkey" : "color", "tagvalue" : "white" } { "_id" : 903, "tagkey" : "store", "...
0
votes
0answers
12 views

FeathersJS - create an object containing other objects

I'm having trouble implementing saving an object that contains other objects in feathersjs: const FirstSchema = new Schema({ refIdArray: [{ type: mongoose.Schema.Types.ObjectId, ref: "...
0
votes
0answers
9 views

How should I structure MongoDB collections for periodically collecting data?

I currently have my database set up as follows. First, there is one collection "ids", which contains a single document structured like so: {"_id": "master", "ids": ["id_1", "id_2", ...]} This list ...
0
votes
1answer
10 views

Find Documents whose Subdocument Fields partially match given Criteria with Mongoose

I have using nodeJS and mongoose/mongoDB to build an API. Consider the following model for a generic Model (Gmodel): { name: "teleni", type: "person", data: mixed } The data field in this ...
0
votes
1answer
14 views

Invalid URI scheme: mongodb+srv ,Mongodb error

I am trying to connect with mongodb and my code is running fine on my system but it is giving me an error on aws server. import pymongo url="mongodb+srv://name:Password@cluster1-actwo....
0
votes
0answers
19 views

Why no data is returned from mongodb?

I'm using mongoid with Rails API, I can load the database without a problem but when I try to get some data, none is returned Here is a simple test directly on console (byebug) Quote.where(author: '...
0
votes
1answer
19 views

Mongodb aggregation - count arrays with elements having integer value greater than

I need to write a MongoDB aggregation pipeline to count the objects having arrays containing two type of values: >=10 >=20 This is my dataset: [ { values: [ 1, 2, 3] }, { values: [12, 1, 3] }, { ...
-1
votes
0answers
8 views

How can i populate dynamically data from the mongodb document

How can i populate dynamically data from the mongodb document let say i have a array of objects of doc data in which fields like questions answers hence is an array of answers of objects and every ...
0
votes
1answer
18 views

Mongoose.findOne returns same document

I am trying to get the mongodb document by its id using express as a backend. The findOne & populate query returns the same document every time I make request to route.I want to return a patients ...
0
votes
0answers
5 views

MongoDB docker build failing due to Fatal Assertion 28558 at src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp 365

I have a docker-file that starts up a MongoDB instance. I a docker-compose file to bring up this container. Here is what the docker-compose.yml file looks like: version: "2" services: mongo: ...
-1
votes
0answers
18 views

Error: key $clusterTime must not start with '$'

i'm getting this error while trying to insert in mongoDB. this means that i need to upgrade my mongoDB "mine in 4.0". The problem here is that M0 clusters in mongoDB have no upgrade it comes only with ...
0
votes
2answers
20 views

Save data to MongoDB using NodeJS

I am trying to pass data to a MongoDB collection and it returns Cannot POST /courseweb/course/add Before passing values through axios I tried postman (a google extension) to send data. This is my ...
0
votes
0answers
14 views

MongoDB: sort array in subdocument and keep document structure

I have documents with a structure like this: _id: 5d090529397f79d2fefc57fb, result: 23232, length: 32323, position: 34343, temperatures: { temp_limits: { min: 10, max: 31, ...
-1
votes
0answers
14 views

How to build a simple reviewing and 5-star rating system for the food recipe website project? [on hold]

I'm very new to web technologies and this is basically for a term project that my team is working on. We are working on a food recipe site. As of now, I'm not quite sure how to implement a simple 5-...
2
votes
0answers
21 views

How to delete in cascade in several models with mongoose?

I have these 3 models in mongoose: TravelSchema var travelSchema = new mongoose.Schema({ name: String, description: String, mexican_currency_value: mongoose.Schema.Types.Decimal128 }) ...
0
votes
0answers
14 views

How to connect a spring boot app running locally to a mongodb instance running in a docker container?

I'm trying to connect my spring boot app to an instance of mongodb running in a docker container. The container is started with the port 21017 exposed docker run -p 21017:21017 --detach --name ...
0
votes
0answers
12 views

MongoDB/Mongoose Connection Error when Dbname is used in the connection string

A NodeJS app uses mongoose 5.6.0 to connect to MongoDB 4.0.10 which runs on localhost inside a docker container. The connection can be established when we use const mongoUri = 'mongodb://admin:...
0
votes
1answer
20 views

mongoose.findOne return null

I have created routes in express to enter patients data to mongodb & to get the data from the database. The expected result is to get patient profile in return. There is some error in the get ...
1
vote
0answers
15 views

mongodb pymongo.errors.DocumentTooLarge error

I created a query on mongodb filtering documents for language and data type like this: data = db.my_collection.find({"language": my_language, "data_type": {"$exists":...
0
votes
1answer
15 views

How to query for index access count using MongoDB .NET Driver?

I'm looking to retrieve index usage information from MongoDB via the .NET driver. For the curious it is to prove in an integration test that an index is being used as intended, specifically the number ...
0
votes
0answers
11 views

Mongoose is not connecting to mongodb-atlas

The code runs without error when the server is local, but when i try to connect to mongodb-atlas it shows an error. //mongoose.connect("mongodb+srv://namdi:@yelpcamp-wd2aa.mongodb.net/test?...
0
votes
0answers
16 views

Accessing nested object values from MongoDB

I have a collection in MongoDB of nested objects (basically a tree structure). I am trying to access certain "id" and "user_id" values in "children". The collection looks like this: Image of a tree ...
1
vote
4answers
36 views

How to start mongodb from dockerfile

I'm building a dockerfile. But I meet a problem. It says that : /bin/sh: 1: mongod: not found My dockerfile: FROM mongo:latest FROM node RUN mongod COPY . . RUN node ./scripts/import-data.js ...
0
votes
0answers
21 views

MongoDB query - pass the function to the Model.find()

I have issue with querying MongoDB (Mongoose) by passing the function as parameter in Model.find() -> like this Model.find(searchCondition). I hope that you can help me. // Fetching patients from the ...
0
votes
0answers
12 views

How to retrieve data from an array from a mongodb document

I have a question about how to retrieve data from a mongodb and how to store it in my Java code. I select all the documents (there are only 5) from my mongodb and then store its content in my Java ...
2
votes
2answers
30 views

How to iterate array inside the object using mongodb

I tried to iterate array inside object key value using mongodb.but its not working.how to achieve it. Database code db.product.aggregate([ { $lookup: { from: "...
1
vote
0answers
26 views

MongoDB: Get list of newly added users in last five minutes

So I have a collection in which I dump logs.Each log have EndUserId field. The mongoose schema is as follows: var mongoose = require("mongoose"); var Schema = mongoose.Schema; var ChatbotLogsSchema = ...
0
votes
1answer
23 views

Concat two columns in where clause in laravel mongodb to search

Here is my code $users = User::where('f_name', 'LIKE', "%{$search}%") ->orWhere('l_name', 'LIKE', "%{$search}%") ->orWhere('state', 'LIKE', "%{$search}%") ->orWhere('city', '...
2
votes
0answers
20 views

Mongo shell: list all declared variables

Is there a way in the mongo shell to list all variables that have been created so far. E.g. when I create a bunch of variables like var myDocument = db.myCollection.find({"awards.wins":8}); var b = ...
0
votes
1answer
19 views

How to do a mongodb search for a string in array of string

I'm trying to filter a list of objects based on the objects include a particular string value inside a array of string field. The collection structure : { "_id" : ObjectId("...
0
votes
0answers
12 views

MongoDB golang driver not returns unrecognized field `hint` when using hint with CountDocument

So I am using the official mongo driver for go go.mongodb.org/mongo-driver and I am running mongodb v4 in a container. All operations work fine but when I try to add a hint to CountDocument it fails ...
-1
votes
0answers
20 views

How can I add year founded to the schema?

How can I add year founded property and revenue to mongoose schema? I am not sure how to give the property. name: String, yearFounded: , revenue: ,
0
votes
1answer
17 views

@DateTimeFormat annotation in entity/document class

I need to map string from mongo to LocalDateTime in entity class. Date in mongo is stored as string, not ISODate. eg. 2015-02-05 10:10:10 I tried to use @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss"...
0
votes
2answers
19 views

How to retrieve object values with same key inside an array

I'm trying to get (filter) all the objects from a document array that match the same key. Document Schema example: { ... country: "ES", aut_comms: [ ... {name: "...
0
votes
0answers
10 views

Transaction in mongodb with Springboot java

I need control transaction in MongoDB with spring boot but I can't do it. I see the document on the homepage but I can't run it. Please help me. Url homepage about the transaction: https://www.mongodb....
0
votes
1answer
17 views

How to map two collection in mongodb and from collection get only one data

I tried to map two collections(product,order).Its successfully mapped and get data in mongodb.but I have doubt from collection product and to collection order.I want only one field to map in product ...
2
votes
2answers
24 views

Get dict from Mongo and convert to ndarray using Numpy

I have an aggregate query in Mongo that returns data like: {a: 1, b: 2, c: 3} {a: 4, b: 5, c: 6} {a: 7, b: 8, c: 9} I would like to do an FFT for a, b and c and I need to put the data in 3 numpy ...
0
votes
0answers
25 views

Mongodb update object in array

I have the next collection in mongodb. {"_id" : "10", "g_user_id" : "10", "contracts" : [ { "user_name" : "JOHAN", "contract_id" : "contract1", "...
1
vote
0answers
15 views

Immutables Autogenerated repository for MongoDB throws “Can't find a codec for interface” CodecConfigurationException

Problem Description. I use hereafter a simplified version of the example that is currently in the immutables site. So I have an item that I want to use with MongoDB. @Value.Immutable @Mongo....
0
votes
0answers
8 views

Deleted documents in ghtorrent mongodb dumps

I cycled through the mongodb daily dumps(from the github API) from ghtorrent and I couldn't find field that shows what documents got deleted that day. Is there away to know so?
0
votes
0answers
9 views

Why doing typecasting of an input received from the user before saving it to mongodb the typecasted value is not saved in the database?

if(value === 'MarksSecured') { user.Education[key][value] = Number(Education[key][value]); } Here is the part ofmy schema for the above operation Education: [ { ...
0
votes
0answers
20 views

MongoDB: How to combine 3 collections in only new empty collection?

I have 3 collections in MongoDB that have the same structure. I want to do as SQL-Union, that is I want to combine them in a new empty collection. I have 'col_1', 'col_2', 'col_3' while the new ...
0
votes
0answers
6 views

How to process mongodb documents with N applications instances in parallel without duplications?

I'm planning an application that can run in multiple instances with a goal of processing documents from mongodb. For example each instance of the application would read 1000 documents and then process ...
0
votes
0answers
8 views

Transaction Management in Spring & MongoDB when there is no replica Set

I have to handle transaction management in my spring project and DB is MongoDB. There is no replica Set for the DB. My question about how to handle transaction management?
0
votes
0answers
21 views

Update array in object Mongoose

I'm learning MongoDB (Mongoose) and I'm trying to update/delete an array into an object. I don't understand how I can select the right parts of my schema. Is there a way to to that, or is my schema ...
0
votes
0answers
7 views

Request time too slow when connect to remote mongodb

I have express app when I connect via mongoose mongoose.connect(process.env.DB_URL,{ reconnectInterval: 500, // Reconnect every 500ms poolSize: 10, // Maintain up to 10 socket connections ...
0
votes
1answer
16 views

How can I check or stream everytime there's a new object inserted to the mongodb?

I am new in nodejs and mongodb. I was trying to get, check, or stream an object in a collection whenever there's a new data inserted. Could this be possible? I hope someone can help me. Thank you in ...