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

Support argument-less where

      Rails allows Model.where to take no arguments, as follows:

      irb(main):002:0> Post
      => Post (call 'Post.connection' to establish a connection)
      irb(main):003:0> Post.where
        Post Load (6.6ms)  SELECT  "posts".* FROM "posts" LIMIT ?  [["LIMIT", 11]]
      => #<ActiveRecord::QueryMethods::WhereChain:0x00007f2bdc75eea0 @scope=#<ActiveRecord::Relation [#<Post id: 1, title: nil, user_id: nil, created_at: "2018-09-27 03:00:21", updated_at: "2018-09-27 03:00:21">, #<Post id: 2, title: nil, user_id: "2", created_at: "2018-09-27 03:00:42", updated_at: "2018-09-27 03:00:42">, #<Post id: 3, title: "foo", user_id: nil, created_at: "2019-02-02 02:12:51", updated_at: "2019-02-02 02:12:51">, #<Post id: 4, title: "bar", user_id: nil, created_at: "2019-02-02 02:13:09", updated_at: "2019-02-02 02:13:09">, #<Post id: 5, title: "bar", user_id: nil, created_at: "2019-02-02 02:13:37", updated_at: "2019-02-02 02:13:37">]>>
      

      Mongoid currently requires where to have an argument:

      irb(main):004:0> Band.where
      Traceback (most recent call last):
              2: from (irb):4
              1: from (irb):4:in `rescue in irb_binding'
      ArgumentError (wrong number of arguments (given 0, expected 1))
      

            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: