MongoDB $lookup: Limitations & Usage -


with new aggregation pipeline stage $lookup able perform 'left outer joins'.

at first glance, want replace 1 of our denormalised collections 2 separate collections , use $lookup join them upon querying. solve problem of having, when necessary, update huge number of documents. can update 1 document.

but surely true? nosql, document database after all!

mongodb's cto highlights concerns:

we’re still concerned $lookup can misused treat mongodb relational database. instead of limiting availability, we’re going developers know when use appropriate, , when it’s anti-pattern. in coming months, go beyond existing documentation provide clear, strong guidance in area.

what limitations of $lookup? can use them in real-time, operational querying of our data or should left reporting, offline situations?

i share same enthusiasm $lookup.

i think there trade-offs. 1 of major concerns of sql databases (and 1 of reasons genesis of nosql) @ large scale, joins can take lot of time (well, relatively speaking).

it helps in giving declarative model data, if start model entire nosql database though database of rows , tables (just using refs, example), begin modeling though it's sql database (to degree). mongodb mentioned (like put in question):

we’re still concerned $lookup can misused treat mongodb relational database.

you mentioned:

this solve problem of having, when necessary, update huge number of documents. can update 1 document.

i'm not sure collections exactly, sounds use $lookup.

can use them in real-time, operational querying

i say, again, depends on use-case. you'll have compare:

  • desired semantics of queries (declarative vs imperative)
  • whether modeling data more relational (and using $lookup) in circumstances worth potential trade-off in computational time (that's assuming querying across collections concerned about, computationally speaking)

etc...

i'm sure in coming months we'll see perf tests of "left outer joins" , perhaps mongodb start writing posts when $lookup antipattern.

hope answer helps add discussion.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -