amco / dolly

Not an ORM for CouchDB in rails.
8 stars 3 forks source link

Feature/type mango query #152

Closed ErickFabian closed 5 years ago

ErickFabian commented 5 years ago

Enables querys such as: query = {and: [{ type: { eq: 'user' } } , { username: { eq: 'ErickFabian'}} ]} User.where(query) => [....]

and

User.where({username: { "$type": "null"}})

javierg commented 5 years ago

what will User.where({username: { "$type": "null"}}) return?

ErickFabian commented 5 years ago

@javierg

[#<User:0x00007fcedd9d4960
  @account_active=true,
  @allocated_aluzo=false,
  @type=nil,
  @username=nil>,
 #<User:0x00007fcee43a4110
  @account_active=true,
  @allocated_aluzo=false,
  @username=nil
]

returns an array of objects that have nil usernames

ErickFabian commented 5 years ago

@javierg Should i validate the correct values are used for the $type operator as a better developer experience?

Valid values are "null", "boolean", "number", "string", "array", and "object".