[JAVA-1069] aggregation query from 2 tables Created: 05/Jan/14  Updated: 11/Sep/19  Resolved: 05/Jan/14

Status: Closed
Project: Java Driver
Component/s: JSON
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: lital Assignee: Unassigned
Resolution: Done Votes: 0
Labels: aggregation, jaspersoft, subquery
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

we have a schema:

stores:
{_id , name}
getways:
{_id, store_id }
txes:

{tx_id,getway_id}

store has many getways, and getway has many txes.

We need count of txes for specific store.

in sql:

select count
from txes
where getway_id in
( select _id
from getways
where store_id = xxxx)

How can I write it in mongo query?

I write this query in jaspersoft studio mongo query.

Thanks for your help



 Comments   
Comment by Jeffrey Yemin [ 05/Jan/14 ]

Hi there,

This Jira project is intended for reporting bugs and requesting enhancements to the MongoDB Java driver. So even though you may be trying to accomplish your goal using the Java driver, the question is really a more general one about MongoDB schema design, which is better handled on either Stack Overflow or the mongodb-user Google group.

Thanks in advance for your understanding.

Generated at Thu Feb 08 08:53:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.