Category "mongodb"

MongooseError: Operation `therapists.find()` buffering timed out after 10000ms

I have seen this issue published in a few places however I still don't have a solution. I am using a node server and can connect to my database correctly with a

Shard key with mostly even distribution. How to handle outliers?

I'm learning about sharding approaches. How to achieve good horizontal scalability with a large number of shards in an IO-heavy application. Below I describe a

koa doesn't render a page (404) after mongodb request

I am trying to render a page with something I load from MongoDB: router.get('/messages', async (ctx, next) => { await MessageModel.find() .then((resul

How to create a test Unit method for a get request that fetches Data from Database(MongoDB)?

Get request method in tasks.js file const { Task } = require('../model/Tasks.js') const asyncWrapper =require('../middleware/async') const getTask = asyncWrapp

How to use ArrayFilter with $push to insert sub document

We have a requirement to insert to the sub array when sub array contains some value, but I get an error when using push with arrayFilter: fail to run update: w

MongoDB .NET Driver - StartsWith & Contains with loosely typed data

I can use the following for exact matches on loosely typed data in MongoDB: var mongoClient = new MongoClient(con); IMongoDatabase mongoDatabase = mongoClient.G

How to find Distinct No of Document on specific field MongoDB and Implement in Java

I have data and need to group by two fields and in response display unique filed along with the count on this field. Sample data: [ { "categoryCode":"c

Djongo migrate models cons

Its's nice to see mongodb is connected with django but doesn't support completely. I explain why so because when you install any third party packages to your pr

How to find Average of star Rating in mongoose

I have working on my final year college project On MERN stack. my problem is mentioned bellow please help me. const Organization = mongoose.Schema({ name: {

Limit and Sort don't both work when used together mongodb php

Obligatory - I know this question has been asked before, but answers back then relate to the old mongoldb driver, I'm using the pecl mongodb php library. The ai

Jest database setup before any test suits are run

I'm trying to seed my entire database for all the necessary resources that need to be present to test my API successfully. My tests are in several files. How ca

MongoClient not connected error while trying to use Mongoose?

As part of my course I'm learning mongodb and now Mongoose. I've written the code exactly as done in the lesson but when trying to start it with node app.js I g

MongoDB aggregate and then flatten

FULL DISCLOSURE: I'm a MongoDB noob I'm dealing with a legacy DB structure. A part of my MongoDB looks like this currently: Events (_id, name (string), ...) Ord

Connecting a MongoDB serverless database to Mongo Charts

I want to connect a serverless MongoDB instance to MongoDB charts. I don't see any of my serverless instances when I try to add data sources on my Mongo Chart d

Spring Boot MongoDB the field with version annotation does not increment

This question asked several times before, but the answers in these questions didn't work for me. This is my Book document @Document @NoArgsConstructor @ToString

How do I get the POST data from a netlify serverless function?

Here is the code for my server which works fine. I am trying to achieve this with netlify's serverless functions which I have pasted further below. CODE ON STAN

Multer GridFsStorage Dynamic Configuration for Multiple MongoDB Connections

So I'm using MongoDB Atlas, Mongoose, Multer and GridFsStorage to upload files to a single database on the cloud which works fine, but I want to be able to uplo

Mongoose and Next.js: Unhandled Runtime Error TypeError: Cannot read properties of undefined (reading 'Token')

I basically defined this Model, much like another which doesn't error out; So I am stumped as to why it's not working... Here is a Minimal, Reproducible Example

I want to find the last object which i'm posting in my database without any condition but i can't find any method for that

Data.findOne({}).then((respp)=>console.log(respp, "find one")) Like I have this method this is returning First object and if I apply a condition then i can

How to sort data based on entry of parent collection in mongodb using mongooose package

How to sort data based on entry of parent collection in mongodb using mongoose package. My schema is organised as given below Profile Schema const mongoose