Category "mongodb"

How to validate ObjectId query param in FastAPI

I have an endpoint that recibe and id field used to get data from MongoDB's _id: from fastapi import APIRouter from bson import ObjectId router = APIRouter()

Spring Data MongoDb - how to use "findAll" method which return only valid documents

I use Spring data mongo as ORM for accessing to my MongoDb. I need to read a MongoDb collection containing documents that I don't manage content and its validit

MongoParseError: URI does not have hostname, domain name and tld

I'm getting this error when I try to connect my app(nodejs) to mongodb. I really appreciate your help here. MongoParseError: URI does not have hostname, domain

Delete result of mongodb $lookup aggregation

How do I delete all the chunks documents which are returned as a result of this aggregation? db.getCollection('chunks').aggregate([ { $lookup:

Not able to add more than 1 post request in the mongo db

i am using mongo db to fetch and post the data but unable to post more than 1 request here is my code ON posting the different values second time i am getting t

how can I give order wise Projection in mongodb query

I am new to monngodb, my query is below $mng = new MongoDB\Driver\Manager("mongodb://localhost:27017"); $filter = [ "archival"=>0];

How can i get specific error messages from a Mongoose Schema?

I am trying to set up user validation in Mongoose and struggling to get the specific messages to appear. Here is my model const userSchema = new Schema({ n

Get index size on each shard?

I have a compound index on a sharded cluster living on Mongo Atlas. The Atlas UI tells me the index size is 10.1GB. Similarly, MongoDB Enterprise > db.myColl

Trying to iterate over a mongodb cursor twice - failing

I am executing a query against my mongodb database... and then in two separate spots in my front end logic, I need to iterate through the results to extract / s

Mongodb: Text Indexes vs Atlas Search

These two features look pretty simmilar, but Atlas Search is fresh and maybe more powerfull. Is Atlas Search a replacement for Text Indexes in MongoDb? Will Tex

Cannot connect to MongoDB Atlas despite allowing all IP address to access

I am unable to access MongoDB database for some reason. I have run through the usual suspects such as removing <> brackets around the password and also ma

Unable to connect MongoDB server?

I have tried to connect to MongoDB server using the below-mentioned link but I am getting an error, I have entered the correct password and dbName but it couldn

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client. Why?

I am having a issue while saving the image file in MognoDB. It is saying the error (node:14849) UnhandledPromiseRejectionWarning: Error [ERR_HTTP_HEADERS_SENT]

Using stream in mongodb is very slow

I am using the nodejs driver and the collection has ~45k documents, the query returns ~3k documents, but its almost taking 30seconds to iterate. The batch size

How to have class-transform converting properly the _id of a mongoDb class?

I've the following mongoDb class: @Schema() export class Poker { @Transform(({ value }) => value.toString()) _id: ObjectId; @Prop() title: string;

Query by an element of an array of objects using C# driver

I have objects like this sample in my database: { "_id" : ObjectId("62623cd94c111e4e73c98e88"), "CDate" : null, "CUser" : "dexadminserver",

Query by an element of an array of objects using C# driver

I have objects like this sample in my database: { "_id" : ObjectId("62623cd94c111e4e73c98e88"), "CDate" : null, "CUser" : "dexadminserver",

MongoDB: Find an object by its ID without knowing the collection

I have an mongodb databse with 100+ collections. I'm trying to find an object, with a known ObjectID, that belongs to some (unknown) collection of this database

spring mongodb: arrayFilters is absent

I need to build an update operation like this: db.collection.update({ "referencedGeneralPractitioner.id": "id1" }, { $set: { "referencedGeneralPractitio

Mongoose.js not removing object from array

I'm using Mongoose with my Discord bot and I'm making the feature where the infractions can be removed from any mentioned user(s). The infractions are saved in