Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-2088

Database Session or Threadsafe for relational database

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.0.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:

      Hi Durran,

      I would like to ask how i could include relation by using threadsafe database?
      example :

      Class Blog
      include Mongoid::Document
      ...
      has_many :comments
      belongs_to :author
      end

      Blog, Comment & Author are using database blog_db with the same session, blog_engine.

      blog = Blog.with(database: "blog_db", session: "blog_engine").first

      how i could do like these:
      comments = blog.comments #=> nil
      author = blog.author #=> nil

      they are not working yet and returning nil. But if I use standard methods they are exist, example:
      Comment.with(database: "blog_db", session: "blog_engine").where(blog_id: blog.id).count #=> 10

      Many thanks,
      jack

            Assignee:
            durran Durran Jordan
            Reporter:
            jackbit jackbit
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: