Question

My database has 2 collections : Cell(_id, segment_id, cell_id) and SegmentSpeed(_id, segment_id, speed) And I want to perform the query below (sql format) in Java :

"Select * From SegmentSpeed Where segment_id in (Select segment_id From Cell Where cell_id>5)"

That is Mysql query, and the problem is I want to execute this query with MongoDb format in JAVA.

Thanks !

Was it helpful?

Solution

MongoDB does not support joins.

You may have to resort to some clunky and inefficient map-reduce operations if you are unable to change your schema.

What you can do is embed the whole SegmentSpeed inside a document of Cell.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top