Category "mongodb"

Populate Failed immediately a ref was indexed in Mongodb via Mongoose Schema

I had a Post Model with a ref as below const mongoose = require("mongoose"); const PostSchema = new mongoose.Schema( { _id: mongoose.Schema.Types.O

How to get all embeds_many items in Mongoid

I'm Using Mongoid and I have two models: class User include Mongoid::Document include Mongoid::Timestamps embeds_many :tickets field :email, type: Str

insert with "error on non existing collection" semantics

The usual behavior in MongoDB is that collections are created upon first document insertion, which is fine for most of the use cases. However, in some cases you

Django pymongo search, sort, limit on inner array and count them

I am learning Django with MongoDb and have a collection to search into. Here is a sample document in the collection: { "_id": { "$oid": "62615907568ddfc

Mongodb: Merge nested objects based on common identifier

I have 3 objects like this {"_id":{"$oid":"625f0e73b1d7269de9ebdaeb"}, "Type":"scalar", "Temperature":22.79, "Vibration":{"A-P2P":{"X":85},"Z2P":{"X":43},"Crest

How to projection fields for a dictionary (C#, MongdoDB)

I am trying my luck here, I have a model which is like the following public class RowData : BaseBsonDefinition { . [BsonExtraElements] [BsonDictionaryOption

How to insert array to object using postman and nodejs. Send the data to mongodb

I Write My code like this but it has error, How to rewrite this code db.collection('collection_name').insertOne({ name:req.body.name, details:[{ age:req.body.ag

Error message : MongoServerError: bad auth :Authentication failed

What is the reason behind this error? this code I am using to connect to DB. const uri =`mongodb+srv://${process.env.DB_USER}:${process.env.DB_PASSWORD}@cluster

In Mongo, If a document I'm saving "Prateek" then I don't want on the next create operation even the "prateek" or "praTEEK", etc is saved

//** If I'm adding a new document with the name: "India", then I don't want that the DB allow another name with the name: "INDIA", "india", "indIA", etc. I'm ne

MongoDb Index Search returns the entire collection when using a string contains operation

Why would MongoDb (4.2.6) return every row from an index (Collation locale: en_US, strength: 1), when searching for a string contained in the document field? E

How to get mongo documents created in the last 24 hours using mongoose?

I have this mongoose schema const PictureSchema = mongoose.Schema({ user: { type: mongoose.Schema.Types.ObjectId, ref: 'User', requi

MongoDB Atlas Search Stage for newsfeed with GoogleRating, CurrentDate, LikeCount & CommentCount

I'm working on social media platform and I need to fetch posts for newsfeed with mongodb search query. currently I'm using dynamic index on my post collection,

failed to fetch data from mongodb in dynamic route

I use mongoDB, after run server site 1st time all data load and display in UI. But whenever I try to show dynamic route using an event handler , and this give m

MongoDB atlas connection error with nodejs

enter image description here This error is showing when I connect the MongoDB now how can I solve it

Edit value for a key in a Map in Angular

I have a model that uses a Map for eg: (I also have other properties such as Name) export class User { _id!: string; accounts!: Map<String,Number>

Getting mongo authorization errors with userAdminAnyDatabase role

I am trying to get authorization working on a mongo database on a new Ubuntu machine. I have created an admin user with the role userAdminAnyDatabase: admin>

Modifying Schema only for one document

I'm creating an application in the MERN stack and I stumbled upon a problem. I will start by explaining how that app is going to work. So, in that application u

Writing multithreaded code to generate incremental index

I want to write a code in following scenario : we want to design an invoice generator.this invoice generator also generates an incremental invoice no .Also note

How to add collation in indexes for mongodb?

I work with Mongoengine in Django, got task to sort by first_name, last_name fields ignoring case and leading whitespaces that is why add collation in queryset:

Spring boot MongoTemplate group without _id

I want a single object from the collection that counts and calculates average. The collection looks like this: [{ "_id" : ObjectId("617822b1d128026ff4c76a76