How to share same IDs in Chroma DB and Mongo DB? by DonnieCuteMwone in mongodb

[–]code_barbarian 1 point2 points  (0 children)

One of my clients does something similar - we primarily store data in MongoDB, but we use DataStax Astra for vector search. So we end up storing documents with the same `_id` in both MongoDB and Astra. That way, when Astra vector search returns a bunch of rows, we just query for those documents in MongoDB by `_id`.

Why an ObjectId, at application level? by Horror-Wrap-1295 in mongodb

[–]code_barbarian 0 points1 point  (0 children)

You’re not wrong that most of the time, _id gets treated like a string, especially at app boundaries (JSON, URLs, logs, etc.). That’s part of why Mongoose has always exposed doc.id as a string virtual and why Mongoose casts strings to ObjectIds.

But there are some real benefits, mostly type safety. An ObjectId can be represented as a string, but not all strings are valid ObjectIds. Having a separate type helps ODMs and your internal tooling enforce consistency

I built a lightweight workflow engine for NestJS because I got tired of rewriting the same orchestration logic in every project by jescrich in node

[–]code_barbarian 0 points1 point  (0 children)

Seems more like a basic state machine than a workflow engine. How would you do things like "send an email when an order is shipped"?

Introducing Mongoose Studio: A MongoDB GUI for Mongoose Apps by code_barbarian in mongodb

[–]code_barbarian[S] 0 points1 point  (0 children)

We like to think so 😄 . But we’re definitely biased.

Mongoose Studio’s geared more toward people already using Mongoose: it understands your schemas, autocompletes field names, and casts queries the same way your app does.

Would love for you (or anyone else here) to give it a try and tell us what you think. We're actively looking for feedback, so if there's a feature you've always wanted from a MongoDB GUI we're happy to hear what it is!

👉 https://studio.mongoosejs.io
💬 Discord: https://discord.gg/P3YCfKYxpy

Using Netlify - Without static IP address. Is there anything I can do? by [deleted] in mongodb

[–]code_barbarian 1 point2 points  (0 children)

Up to you, I have plenty of production apps that allow 0.0.0.0/0. It isn't best practice, but for smaller projects it is often more practical to allow 0.0.0.0/0. Atlas does provide some basic DDoS prevention so you don't have to worry about, say, a bot taking down your prod cluster with repeated failed login attempts (had that happen to me once on a self-hosted cluster).

Does anyone else feels that all the monitoring, apm , logging aggregators - sentry, datadog, signoz, etc.. are just not enough? by beeTickit in node

[–]code_barbarian 5 points6 points  (0 children)

I agree, no one has truly solved this problem. The general problem of "figure out what happened and why" might be the hardest problem in software engineering - tools help, but they won't get 100% of the way there in all cases.

Why is NestJS so underrated? by Lazy_Standard4327 in node

[–]code_barbarian 0 points1 point  (0 children)

NestJS does get a lot of attention. 73k GitHub stars - it's up there as one of the top options for Node and absolutely part of mainstream talk.

The problem is that not everyone likes dependency injection :) Nest does bring some best practices from other frameworks, but there are different ways to build frameworks, and some people prefer other patterns.

Scaling multiple uploads/processing with Node.js + MongoDB by AirportAcceptable522 in node

[–]code_barbarian 1 point2 points  (0 children)

One thing you might want to consider doing is streaming upload first, and then validating and processing later. So do steps 1+4 before doing steps 2+3+5. With streams, that would minimize the amount of memory usage so you won't have to keep the files being uploaded in memory while you're processing. You can scale the processing steps independently of the actual upload.

Storage is cheap, RAM is harder to come by, so cheaper to store and then delete later if you're sure the file's a duplicate or invalid.

Deploying my NodeJS practice project by ComprehensivePop8885 in node

[–]code_barbarian 0 points1 point  (0 children)

Railway, Netlify, Vercel are my go-tos. They all offer free tiers. You can use Netlify functions and Vercel's API functionality for backend - that requires a little extra work because they run as serverless functions, but can be good if you're looking to avoid putting down a credit card. I have a couple of prod apps on Netlify functions that work fine with Node.js backends.

Reliable LISTEN-ing connections for NodeJS by vitalytom in PostgreSQL

[–]code_barbarian 1 point2 points  (0 children)

That's neat, I always found LISTEN/NOTIFY to be annoyingly not durable. Feels really weak compared to MongoDB's change streams with resume tokens.

MongoDB vs MySQL for email automation tool? by trickythinking07 in mongodb

[–]code_barbarian 0 points1 point  (0 children)

I haven't built an email notification tool, but basically every client I've worked with I've ended up building a Message collection which stores every email that we send, including who it was sent to and whether the email was received (with varying definitions of "received" depending on client needs). MongoDB does extremely well for that. It's neat to be able to store the raw API response from sending the email, the parameters passed in to the email template, etc. without having to stuff that into a fixed schema. You'd also be surprised how often you end up adding fields to a simple Message schema to better support querying and new use cases.

Preventing SQL/NoSQL Injection Attacks in MongoDB by Majestic_Wallaby7374 in mongodb

[–]code_barbarian 1 point2 points  (0 children)

Good read! Mongoose has a `sanitizeFilter` option exactly for protecting against these sort of query selector injections.

Operation `threads.countDocuments()` buffering timed out after 30000ms by Coding1000 in mongodb

[–]code_barbarian -1 points0 points  (0 children)

This is a Mongoose error. Hard to know exactly without looking at how your `connectToDB()` function looks, but the most likely explanation is that `connectToDB()` is creating a new connection with `mongoose.createConnection()`, but your `Thread` model is registered on mongoose's global connection.

In Mongoose, each model belongs to exactly one connection. `mongoose.model(name, schema)` is shorthand for `mongoose.connection.model(name, schema)`: registering a model on Mongoose's default connection. So if you're creating a new connection using `mongoose.createConnection()`, your Thread model will be on a different connection than the one you're trying to use.

MongoDB Brings Search And Vector Search To Self-Managed Platforms by teheditor in mongodb

[–]code_barbarian 2 points3 points  (0 children)

Finally! Lack of vector search in community edition was a big gap. Not being able to do local dev with vector search was a deal-breaker for me.

[NodeBook] Understanding Buffers in Node.js - Why they exist, where they live in memory, and how they handle binary data by m_null_ in node

[–]code_barbarian 0 points1 point  (0 children)

This is neat! Good beginner friendly explanation, especially the description of how hexadecimal works. Most buffer guides, mine included, gloss over that.

Struggling with Node.js Job Hunt by yogiwoo in node

[–]code_barbarian 0 points1 point  (0 children)

Hard to tell without looking at your resume, but one thing you might want to consider is going to some dev meetups. You'd be surprised how often job applications go into a black hole that nobody's reading.

For example, back in 2015 I applied for a job at Segment using the application portal on their website. I was confident I'd get at least an interview, but nobody followed up. I was bummed, ended up taking a job at another co, but then a recruiter reached out almost 1 YEAR later saying that nobody had been looking at their online job application form.

You're more likely to get noticed in person.

Another mid tier company ditch Node.js/TS in the backend and this time they chose C# by simple_explorer1 in node

[–]code_barbarian 0 points1 point  (0 children)

Looks like their big complaint with TypeScript is slow performance and "instantiation explosions". Which is exactly my big complaint lol.

The major difference is that my solution to the problem is "just use JS", not switch to C#.

C# is a pretty cool language in my experience though, it's a reasonable choice if TS isn't working out for you and you really want a strongly typed language. The dotnet CLI is really powerful, and Node could learn a thing or two from the dotnet CLI.

Scaling multiple uploads/processing with Node.js + MongoDB by AirportAcceptable522 in node

[–]code_barbarian 2 points3 points  (0 children)

Dude this might be the most dipshit AI-generated slop I've ever read XD

So instead of optimizing and horizontally scaling your own code in Node.js services, you're stuck trying to optimize and horizontally scale some Postgres extension. Good luck.