Answers.Body: <p>This is a known behavioral issue. PHP considers <code>0</code>, <code>"0"</code>, <code>false</code>, and similar values to be <a href="http://php.net/manual/en/function.empty.php#refsect1-function.empty-returnvalues">“empty”</a>, and Craft only factors most criteria param values into the query if they are not empty. So setting a Lightswitch field’s criteria param to <code>'0'</code> is the same as not setting it at all.</p>
  
  <p>The workaround is to use <code>not 1</code>:</p>
  
  <pre><code>{% set results = craft.entries.section('events').lightSwitchField('not 1') %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-18T15:35:59.897Z
Answers.Text: I've just faced this problem, and it looks like in Craft 3 it's looking for true (or false / not true)
Answers.UserDisplayName: Adam Hopkinson
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-14T16:23:05.530Z
Answers.LastActivityDate: 2015-10-16T13:59:07.377Z
Answers.LastEditDate: 2015-10-16T13:59:07.377Z
Answers.UserDisplayName: Lindsey D
Body: <p>This is super simple, and I don't get why it's not working.</p>
  
  <pre><code>{% set results = craft.entries.section('events').lightSwitchField('1') %}
  </code></pre>
  
  <p>Returns all entries in Events where the light switch field is green.</p>
  
  <pre><code>{% set results = craft.entries.section('events').lightSwitchField('0') %}
  </code></pre>
  
  <p>Returns all entries in Events. Period. Not all entries that the lightswitch is set to off.</p>
  
  <p>I want to get all entries where the lightswitch field is off. Later I'm going to chain some other fields to the query too.</p>
  
  <p>What have I not understood about how this works?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-14T16:19:33.450Z
Comments.Text: Have you tried using `true` and `false` in place of `'1'` and `'0`'?
Comments.UserDisplayName: Joshua Baker
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-15T08:41:05.440Z
Comments.Text: I had, it makes no difference. Answer was provided by Lindsey below: it's a Craft quirk :/
Comments.UserDisplayName: Matt Wilcox
Tags: <entries>
Title: craft.entries and lightswitch
ThreadText: # craft.entries and lightswitch
  
  (Asked by: username_0 on 2015-10-14)
  
  This is super simple, and I don't get why it's not working.
  
  ```
  {% set results = craft.entries.section('events').lightSwitchField('1') %}
  
  ```
  
  Returns all entries in Events where the light switch field is green.
  
  ```
  {% set results = craft.entries.section('events').lightSwitchField('0') %}
  
  ```
  
  Returns all entries in Events. Period. Not all entries that the lightswitch is set to off.
  
  I want to get all entries where the lightswitch field is off. Later I'm going to chain some other fields to the query too.
  
  What have I not understood about how this works?
  
  **Tags:** entries
  
  > **Comments:**
  > **username_1**: Have you tried using `true` and `false` in place of `'1'` and `'0`'?  
  > **username_0**: I had, it makes no difference. Answer was provided by username_2 below: it's a Craft quirk :/  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2015-10-14. Score: 24 | Accepted answer
  
  This is a known behavioral issue. PHP considers `0`, `"0"`, `false`, and similar values to be [“empty”](http://php.net/manual/en/function.empty.php#refsect1-function.empty-returnvalues), and Craft only factors most criteria param values into the query if they are not empty. So setting a Lightswitch field’s criteria param to `'0'` is the same as not setting it at all.
  
  The workaround is to use `not 1`:
  
  ```
  {% set results = craft.entries.section('events').lightSwitchField('not 1') %}
  
  ```
  
  > **Comments:**
  > **username_3**: I've just faced this problem, and it looks like in Craft 3 it's looking for true (or false / not true)  
  
  ---
  
  