Reputation: 602
Linq supports most of the MongoDB operations. But I'm confused that does Linq support join collections in MongoDB?
If supports, could you give an example?
If doesn't support, must we apply mapreduce operations to join collections?
Upvotes: 1
Views: 709
Reputation: 10708
Linq, both syntactically and via the existing method class, does support Join
operations.
However, since Queryable
objects get converted under the hood into queries based on database driver, you would need to look into MongoDB for whether Mongo supports those join operations.
Note that if it doesn't it's always possible to perform certain operations in memory, which is often necessary when method calls get involved - just as .AsEnumerable()
, which spite out an IEnumerable
. Since the extension methods on IEnumerable
perform foreach
loops instead of adding Expression
data, any further calls get executed on objects in-memory.
Upvotes: 1