Category "mongodb-query"

How to send query with variables from Rstudio to Mongo database?

I'm trying to send query to my Mongo database depending on a variable producted in my R code. Unfortunately, Mongo query needs double quotes and the function "p

How would YouTube store data of who liked which videos?

If Youtube uses MongoDB as their database, then how would they store the who liked which videos information? Option 1: Store it in the Videos collection with a

Delete objects that met a condition inside an array in mongodb

My collection has array "name" with objects inside. I need to remove only those objects inside array where "name.x" is blank. "name": [ { "name.x": [

Error: Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer and local server is down and app crashed

C:\project\server-assign-11\node_modules\bson\lib\error.js:41 var _this = _super.call(this, message) || this; ^ BSONTypeErro

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

Casting an object within a MongoDB document to date time within a filter definition builder

I am hoping someone can help me as I am new to Mongo DB or point me to a work around, I have a property within a Mongo DB document which is of type object, but

How to check if an area intercepts with any one of other given areas

Before asking this question I read these answers, but could not find the solution: Check if coordinate is within area Geolocation - Check if a location belongs

Why MongoDB saves Hash value in different format?

I am learning IPFS and trying to save IPFS file info in MongoDB. After uploading, I get one hash value ex: {fileHash: CID(QmbCaWPi9tSqcnykvBUMaH2M1d5PiVPLEfPwhJ

mongoDb - How do I delete an object from a nested array

"ProductCategory": [ { "_id": "6246e0d09b16cf549256ed75", "name": "Arduino Boards", "desc": "this is for demo purpose"

MongoDB Group by field, count it with condition

I would like to count different hu for a shipment. So I write this query but how I can count different hu group by shipment ? my query : db.eventstranslated.agg

How to get decrypted values in the aggregation result by the using of getter and setter in node.js

var mongoose = require("mongoose"); const Schema = mongoose.Schema; let CryptoJS = require("crypto-js"); function encrypt(text) { try { let ciphertext =

How to Insert new documents according to a condition that can be appliyed on one of them

I have a collection where I store unique uID for a user and I also have to register them manually. While registration I pass multiple IDs in an array and now I

Counting $lookup and $unwind documents filtered with $match without getting rid of parent document when all results match

I have a collection "Owners" and I want to return a list of "Owner" matching a filter (any filter), plus the count of "Pet" from the "Pets" collection for that

Query over a field which is deep inside MongoDB collection using array of possible options

I have a list of commentDocument collection in MongoDB where each has the following structure: { "commentName": "test comment", "outputs": { "ex

How to query Child Reference Pattern collection with $graphLookup

I have a collection with child reference. Each document can have multiple parents. How can I query it with $graphLookup in order to make a result prepared for a

Access root document map in the $filter aggregation (MongoDb)

I apologize for the vague question description, but I have quite a complex question regarding filtration in MongoDB aggregations. Please, see my data schema to

How to delete and insert with a single command in mongoDB?

So, I have a collection like this: [{ "name":String, "address":String, "hobby":Array of Strings }...] Every hour I query an API and get the response l

how to replaceOne document in MongoDb with Mongo database command

We have requirement to execute replaceOne operation with db.runCommand() I checked list of commands from here, but i haven't found any command to replace one do

How to filter documents by having a list of words which should not be inside of them in MongoDB Atlas Search?

For example I have the array ["java", "perl", "scrum"] and the following documents: { id: 1, title: "Java Software Developer" }, { id: 2, title: "Senior

How to skip a document from retrieving in MongoRepository if it causes an error?

I'm working on a web application built using SpringBoot as backend and MongoDB as DBMS. I'm showing all the latest posts in a web page. In the PostRepository.kt