<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/sort-this-out-0cx7s10qv" -->

---
title: Sort This Out | daily.dev
description: A developer cleaning up after a highly-paid consultant discovers a custom sort function in JavaScript that misuses MongoDB&#x27;s unique identifiers by storing...
canonical: https://daily.dev/posts/sort-this-out-0cx7s10qv
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Sort This Out | daily.dev
og:description: A developer cleaning up after a highly-paid consultant discovers a custom sort function in JavaScript that misuses MongoDB&#x27;s unique identifiers by storing...
og:url: https://daily.dev/posts/sort-this-out-0cx7s10qv
og:image: https://api.daily.dev/og/posts/0cX7S10qV.png
og:image:alt: Sort This Out
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Sort This Out

**[The Daily WTF](https://daily.dev/sources/thedailywtf)** · 2 min read · 0 upvotes · 0 comments

## Summary

A developer cleaning up after a highly-paid consultant discovers a custom sort function in JavaScript that misuses MongoDB's unique identifiers by storing arbitrary objects as _id fields, then inexplicably builds a single key-value object instead of actually sorting anything. The code is a ticking time bomb that hasn't caused issues yet only by luck.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://thedailywtf.com/articles/sort-this-out>

## Similar posts on daily.dev

- [A Unique Mistake](https://daily.dev/posts/a-unique-mistake-4xiva8fyq) · The Daily WTF · 0 upvotes · 1 comments
- [Aggregation Optimization in MongoDB: Sorting With Indexes \(Part 5\)](https://daily.dev/posts/aggregation-optimization-in-mongodb-sorting-with-indexes-part-5--ubdqt9zdr) · Foojay.io · 1 upvotes · 0 comments
- [The Cost of Not Knowing MongoDB \(Part 1\)](https://daily.dev/posts/the-cost-of-not-knowing-mongodb-part-1--7e2zqp5yy) · Foojay.io · 3 upvotes · 0 comments

---

Tags: [#javascript](https://daily.dev/tags/javascript), [#mongodb](https://daily.dev/tags/mongodb)

[View this post on daily.dev](https://daily.dev/posts/sort-this-out-0cx7s10qv)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Sort This Out","url":"https://daily.dev/posts/sort-this-out-0cx7s10qv","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/sort-this-out-0cx7s10qv"},"datePublished":"2026-06-18T11:35:15.111Z","dateModified":"2026-06-18T11:35:31.125Z","description":"A developer cleaning up after a highly-paid consultant discovers a custom sort function in JavaScript that misuses MongoDB's unique identifiers by storing...","image":"https://media.daily.dev/image/upload/s--foaA6JGU--/f_auto/v1722860399/public/Placeholder%2004","thumbnailUrl":"https://media.daily.dev/image/upload/s--foaA6JGU--/f_auto/v1722860399/public/Placeholder%2004","isAccessibleForFree":true,"articleSection":"The Daily WTF","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"The Daily WTF","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/d21a6aa61a7244d893a3b3284df8e2ef","url":"https://daily.dev/sources/thedailywtf"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/sort-this-out-0cx7s10qv","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"javascript,mongodb","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"The Daily WTF","item":"https://daily.dev/sources/thedailywtf"},{"@type":"ListItem","position":3,"name":"Sort This Out"}]}
```

