Category "mongodb"

How to parse the collections in `mongodump` archive output using Python?

Context I have a MongoDB that is backed up every day using the following command mongodump --gzip --numParallelCollections=1 --oplog --archive=/tmp/dump.gz --re

How to Use String instead of ObjectId in "wither" Rust?

I have this code here: pub struct Account { #[serde(rename = "_id", skip_serializing_if = "Option::is_none")] pub id: Option<ObjectId>, pub em

How to Use String instead of ObjectId in "wither" Rust?

I have this code here: pub struct Account { #[serde(rename = "_id", skip_serializing_if = "Option::is_none")] pub id: Option<ObjectId>, pub em

'No write concern mode named 'majority`' found in replica set configuration' error

I'm trying to insert an object into mongodb via a POST request. The object that I send gets inserted in the db successfully, however I get the error mentioned a

How can .save give a "duplicate key error"?

I read that: .save checks if there is a document with the same _id as the one you save exists. When it exists, it replaces it. When no such document exists, it

TS2339: Property 'comparePassword' does not exist on type 'Model<Document, {}>'

I have defined a schema method by using this code. While I use in the service. It is showing a error. // model export interface User extends mongoose.Document

What is needed to be able to make a backup of mongo database

I am trying to make a backup of mongo database, but I keep getting authentication errors. I gave my user all the privileges I could and I still cannot do a back

most efficient way to count docs in mongodb

I have a reasonable collection with a 7.1m docs. I have indexes in place to be able to query and fetch data as needed, all good. But as soon as i try to count,

Duplicate data from Mongo Atlas to self-managed mongodb

I need to duplicate records about 400 million records from Atlas Mongodb to self-managed Mongodb without any changes. After finishing migrating data, these 2 da

How to use mongodb lookup aggregation with sort?

From my connection_dags_archived collection, the following lookup works, giving me the joined items in an array: But when I wish to move it into a pipeline to

how to send ObjectID with ajax to backend (Node.JS) [closed]

font-end code(HTML, Javascript) I want to make delete button but i can't send ObjectID with ajax var retName = $(this).data("row-id"); $.

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