Category "mongodb"

Migrating to 'Morphia' from Hibernate OGM

I have been running MongoDB (5.0.7) for a number of years with Hibernate ORM & OGM. Currently using 'org.mongodb:mongodb-driver-core:4.6.0'. (2022.04.26) Us

Get the value of a field for the latest record in a collection

I have a collection rawUnits. I am getting the latest record from this collection using db.getCollection('rawUnits').find().limit(1).sort({$natural:-1}) This g

Mongo template left join between two queries

In a spring project, I'm using reactive mongodb with mongo template to return a result of type Report class. var res1 = (Flux<Report>) template.find(q

Error when running mongo image - docker-entrypoint.sh: line 381

After installing Ubuntu v20 and then installing docker: $ docker network create test-network $ docker pull mongo $ docker run --network test-network --name mo

Recurring Event between date range in JavaScript

Basically, I need to create an Event, every event will be associated with the fields startDate and endDate. "name": "First Event", "teamName": "Team A",

I am trying to host a project I built on two separate repositories

I have a MEAN stack project that is built on two separate repositories. The backend is using Node.js and handles all API routing to MongoDB Atlas. If i wanted t

Unable to persist Spring data mongodb using save on repository

I am using Spring Data Mongodb and Embeded mongoDB to persist the data. Pom.xml <dependency> <groupId>org.springframework.boot</group

Error: Request failed with status code 500 but it works after I refresh the page

When I run my Next.Js/MongoDB Project for the first time it always greets me with a "Error: Request failed with status code 500", but after I refresh the page i

mongodb shell login - password contains special characters like -(hyphen) and '(single quote)

I am trying to login to mongodb database using mongodb shell, and if the password contains any special characters like -(hyphen) or '(single quote) , it gives e

Mongo Authentication failed after docker-compose up

I'm trying to automate my local dev environment with a mongo docker instance. If I up the image with no users or auth, I can connect fine but when I try to crea

too many org.mongodb.driver.connection: Opened connection for document DB

We have developed an Arest application that uses document DB to store/retrieve user data. MongoClientSettings settings = MongoClientSettings

make repository mutually exclusive in springboot

Is there a way to make a repository mutually exclusive i.e two concurrent values not update the same document in Springboot. My code structure is. //func(versi

Exceeded timeout of 5000 ms for a test with Jest and MongoDB

I'm trying to implement database population by using a migration function. The code works perfectly, it saves all the data into the database, but the test for t

How to store and retrieve checkbox state on refresh of page? Mongoose/EJS/Nodejs/Express

I have a checkbox, essentially like a to do list. When i check the box, I want to retain the state even after i refresh the page by using mongoose. I do know of

Boost search score from data in another collection

I use Atlas Search to return a list of documents (using Mongoose): const searchResults = await Resource.aggregate() .search({ text: { query

Bulk insert only when specified condition is met

I have an array of objects that look like this: { type: 'foo', value : 2, hashedIdentifier : ASDZXC, createdAt : '2022-02-27T14:17:44.860+00:00' } I would like

MongoDB ReplicaSet in K8S -- can't connect via port forward

I have a k8s dev cluster (in aks). I previously used the bitnami chart for deployment of a single MongoDB pod and I never had the following problem. As I'm now

$multiply query not working in Document DB

We have created a documentDb instance having a 4.0.0 version. When running the query using $muliply it throws an error as Bad Query. Query: 'test': { $multiply:

Finding documents that fit json input in mongodb

I'm trying to do a write statement that finds all the documents that fit the JSON data fed through a form. Here's an example of what the JSON looks like. I crea

How to implement pagination for fastapi with mongo db(Motor)

I have a simple REST api which is a books store created with FastAPI and mongo db as the backend (I have used Motor as the library instead of Pymongo). I have a