MongoDB Plugin
  1. MongoDB Plugin
  2. GPMONGODB-189

Direct Link support in referenced objects

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0.RC4
    • Fix Version/s: 1.0.0.RC5
    • Environment:
      grails 2.0.1

      Description

      Hi,

      Please find discussion here http://grails.1312388.n4.nabble.com/Mongodb-RC4-and-Grails-2-0-referenced-objects-td4513464.html
      In two words - It would be great to have direct link support along with the DBRef support - so saving the id of the referenced object and loading it during the selection from database.

      Thanks in advance.

      Regards,
      Nune

        Activity

        Hide
        Harut Martirosyan added a comment -

        Yes, this is really awkward, please implement it, I really need it. ((

        Show
        Harut Martirosyan added a comment - Yes, this is really awkward, please implement it, I really need it. ((
        Hide
        Narek Kalvans added a comment -

        It would be great,,, voted)

        Show
        Narek Kalvans added a comment - It would be great,,, voted)
        Show
        Graeme Rocher added a comment - fixed by https://github.com/SpringSource/grails-data-mapping/commit/b7fbcb0bb726478ebb77faddda23b1440c127877
        Hide
        Rafal Niedzialkowski added a comment -

        I was interested to see this implemented, but I think there may still be a problem. Querying for an entity by an association doesn't appear to work if you set "reference:false".

        Given the following code:
        class Person {
        ObjectId id
        Address address
        static constraints =

        { address reference: false }

        }

        class Address

        { ObjectId id String address }

        The document in mongo looks correct when you save data like this:

        Person(address: new Address(address: "123")).save()

        However queries by association will not work (they will work if you rever to using DbRef):

        def myAddress = Address.findById(new ObjectId("4f9839c4300478722548c2d9"))
        Person.findByAddress(myAddress))

        Any ideas?

        Show
        Rafal Niedzialkowski added a comment - I was interested to see this implemented, but I think there may still be a problem. Querying for an entity by an association doesn't appear to work if you set "reference:false". Given the following code: class Person { ObjectId id Address address static constraints = { address reference: false } } class Address { ObjectId id String address } The document in mongo looks correct when you save data like this: Person(address: new Address(address: "123")).save() However queries by association will not work (they will work if you rever to using DbRef): def myAddress = Address.findById(new ObjectId("4f9839c4300478722548c2d9")) Person.findByAddress(myAddress)) Any ideas?

          People

          • Assignee:
            Graeme Rocher
            Reporter:
            Nune
          • Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: