Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Join data is missing when aggregate lookup is performed using Grails Domain in GORM for Mongo #115

Open
4 tasks
mhemani opened this issue May 6, 2020 · 0 comments

Comments

@mhemani
Copy link

mhemani commented May 6, 2020

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

Steps to Reproduce

  1. Create a Test MongoDB.

  2. Create a Grails Domain called Order with static mapWith = "mongo", BSON ObjectId id, Long orderId, (any other fields you desire) List orderItems and relationship static hasMany = [orderItems: OrderItem]

  3. Create another Grails Domain called OrderItem with static mapWith = "mongo", , BSON ObjectId id, Long orderId, (any other fields that you desire) and relationship static belongsTo = [Order]

  4. Create up a simple controller, view, service etc in Grails and hook it up.

  5. Populate some data in your Mongo Collections such that order.orderItems -> orderItem.id

  6. In a Service method call:
    Order.aggregate( [
    Aggregates.lookup("orderitem", "orderItems", "_id", "orderItems")
    ] )
    and observe the output for orderItems: [] is empty.

  7. In a Service method call:
    Order.collection.aggregate( [
    Aggregates.lookup("orderitem", "orderItems", "_id", "orderItems")
    ] ).toList()
    and observe the output for orderItems: [ ... ] has proper data.

Expected Behaviour

When doing aggregate lookups, the lookup should return the join data.

Actual Behaviour

Join data is missing when aggregate lookup is performed using Grails Domain. Using the underlying collection to do aggregate lookup, join data is available.

Environment Information

  • Operating System: Win10
  • GORM Version: 7.0.0
  • Grails Version (if using Grails): 4.0.0
  • JDK Version: 1.8
@puneetbehl puneetbehl transferred this issue from grails/grails-data-mapping May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant