TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Using MongoDB as your primary Django database

1 点作者 drikerf超过 10 年前

1 comment

csirac2超过 10 年前
I was on a project a few years ago (first PoC with Mongo 1.2, started properly in 1.4, delivered with 1.8). Have the following things improved?<p>- RAM usage was a killer. For some datasets, key names took up more memory than values. - Throwing custom JS at mongo nodes was kind of fun, and we could do interesting stuff with it that we couldn&#x27;t easily do on the previous (non-sharded) datastore. But out-of-memory situations in the JS runtime was less than graceful and caused mysterious replica breakage&#x2F;hangs. Eventually it was suggested that we were using MongoDB in a way that wasn&#x27;t typical or intended, which was fair enough. - We had trouble using it as a truly &quot;schemaless&quot; database (scientist users defining, maintaining, collaborating on their own data with object-level access controls and versioning): when you sort the result of a query (needed for paging), you either needed indexes (exploding RAM usage, finite number of indexes possible per collection) or if you could tolerate slowness (as we could) then you could use .limit() but it was hard to get the what-should-the-limit-be heuristic right, our object sizes varied wildly (sometimes exceeding BSON data size limit at times).<p>In another project we used MongoDB to back a read-only HTTP API representation of some 10s GiBs of reasonably stable and predictable external data, in that case it felt we were fighting it a lot less and it worked reasonably well.<p>I&#x27;ve also messed with eXist, Neo4j (which was fascinating) and a few other NoSQL things - at the end of the day I have to believe that for large sprawling heterogeneous systems (i.e. not the lone django web-app use-case) you will always want to keep authoritative data in something else and treat the NoSQL thing as a cache that can be rebuilt at any time.<p>Curating arbitrarily connected business objects in a graph (or having different codebases with slightly different understanding of the data mess with a given mongo collection) is infinitely harder than orderly relational tables, especially for the traditional DBA people who know how to read business process from a well-designed relational DB and likewise write such a thing by understanding those processes themselves quite well (something I didn&#x27;t give them much credit for until a few jobs ago).