Feed aggregator
Satellite Captures the First Detailed Look At a Massive Tsunami
Read more of this story at Slashdot.
Sugars, 'Gum,' Stardust Found In NASA's Asteroid Bennu Samples
Read more of this story at Slashdot.
Republicans Drop Trump-Ordered Block On State AI Laws From Defense Bill
Read more of this story at Slashdot.
RoboCop Statue Rises In Detroit
Read more of this story at Slashdot.
US Probes Reports Waymo Self-Driving Cars Illegally Passed School Buses 19 Times
Read more of this story at Slashdot.
Microsoft Faces New Complaint For Unlawfully Processing Data On Behalf of Israeli Military
Read more of this story at Slashdot.
Plane Crashed After 3D-Printed Part Collapsed
Read more of this story at Slashdot.
Russia Blocks Roblox, Apple's FaceTime
Read more of this story at Slashdot.
EU Hits Meta With Antitrust Probe Over Plans To Block AI Rivals From WhatsApp
Read more of this story at Slashdot.
Bending Spoons Buys Eventbrite For $500 Million
Read more of this story at Slashdot.
Microsoft 'Mitigates' Windows LNK Flaw Exploited As Zero-Day
Read more of this story at Slashdot.
RAM Is So Expensive, Samsung Won't Even Sell It To Samsung
Read more of this story at Slashdot.
30% of Doctors In UK Use AI Tools In Patient Consultations, Study Finds
Read more of this story at Slashdot.
Subaru Owners Are Ticked About In-Car Pop-Up Ads For SiriusXM
Read more of this story at Slashdot.
Meta Poaches Apple Design Exec Alan Dye
Read more of this story at Slashdot.
New Homes In London Were Delayed By 'Energy-Hungry' Data Centers
Read more of this story at Slashdot.
'End-To-End Encrypted' Smart Toilet Camera Is Not Actually End-To-End Encrypted
Read more of this story at Slashdot.
Top Journal Retracts Study Predicting Catastrophic Climate Toll
Read more of this story at Slashdot.
Russian Astronaut Kicked Out of the US For Stealing Proprietary SpaceX Designs
Read more of this story at Slashdot.
CodeSOD: Pawn Pawn in in Game Game of of Life Life
It feels like ages ago, when document databases like Mongo were all the rage. That isn't to say that they haven't stuck around and don't deliver value, but gone is the faddish "RDBMSes are dead, bro." The "advantage" they offer is that they turn data management problems into serialization problems.
And that's where today's anonymous submission takes us. Our submitter has a long list of bugs around managing lists of usernames. These bugs largely exist because the contract developer who wrote the code didn't write anything, and instead "vibe coded too close to the sun", according to our submitter.
Here's the offending C# code:
[JsonPropertyName("invitedTraders")] [BsonElement("invitedTraders")] [BsonIgnoreIfNull] public InvitedTradersV2? InvitedTraders { get; set; } [JsonPropertyName("invitedTradersV2")] [BsonElement("invitedTradersV2")] [BsonIgnoreIfNull] public List<string>? InvitedTradersV2 { get; set; }Let's start with the type InvitedTradersV2. This type contains a list of strings which represent usernames. The field InvitedTradersV2 is a list of strings which represent usernames. Half of our submitter's bugs exist simply because these two lists get out of sync- they should contain the same data, but without someone enforcing that correctly, problems accrue.
This is made more frustrating by the MongoDB attribute, BsonIgnoreIfNull, which simply means that the serialized object won't contain the key if the value is null. But that means the consuming application doesn't know which key it should check.
For the final bonus fun, note the use of JsonPropertyName. This comes from the built-in class library, which tells .NET how to serialize the object to JSON. The problem here is that this application doesn't use the built-in serializer, and instead uses Newtonsoft.JSON, a popular third-party library for solving the problem. While Newtonsoft does recognize some built-in attributes for serialization, JsonPropertyName is not among them. This means that property does nothing in this example, aside from add some confusion to the code base.
I suspect the developer responsible, if they even read this code, decided that the duplicated data was okay, because isn't that just a normal consequence of denormalization? And document databases are all about denormalization. It makes your queries faster, bro. Just one more shard, bro.
[Advertisement] Keep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.Learn more.