Created
September 6, 2020 09:44
-
-
Save hadrienblanc/1c54ef20ccfcc2dcb574bee72798fc51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Returns nils and strings | |
Model.where(:url.ne => "").count | |
# Returns strings and "" | |
Model.where(:url.ne => nil).count | |
# Returns strings, nils and "" | |
Model.where(:url.ne => ["", nil]).count | |
Model.where(:url.nin => ["", nil]).count | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
source : https://stackoverflow.com/questions/10337847/select-where-not-null-or-empty-in-mongoid