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

Document code w/scope removal from $where in server 4.4

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.2, 7.0.8
    • Affects Version/s: None
    • Component/s: Query

      The following tests are failing on 4.4 server:

        describe "#for_js" do
      
          let!(:match) do
            Band.create(name: "Depeche Mode")
          end
      
          context "when the code has no scope" do
      
            let(:criteria) do
              Band.for_js("this.name == 'Depeche Mode'")
            end
      
            it "returns the matching documents" do
              expect(criteria).to eq([ match ])
            end
          end
      
          context "when the code has scope" do
      
            let(:criteria) do
              Band.for_js("this.name == param", param: "Depeche Mode")
            end
      
            it "returns the matching documents" do
              expect(criteria).to eq([ match ])
            end
          end
        end
      

      https://github.com/mongodb/docs/commit/8b8841d0fc81e86d4d5cf2f8cc5d18a8b8b7739d states that the variables can be passed as scope parameter.

      We need to investigate how to pass the variables as this scope parameter. I expect the above test should continue to work on 4.4 server once we change how we implement map/reduce parameter passing.

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: