Revert "Merge pull request #5858 from bz2/revert_pr5758" #5877

Merged
merged 5 commits into from Aug 9, 2016
Prev

state: tweak user query for mongo 2.4

  • Loading branch information...
commit ac97bffd0261f06df93255bed0a48ce35d1a5eb1 @axw axw committed Aug 9, 2016
View
@@ -231,19 +231,17 @@ func (st *State) AllUsers(includeDeactivated bool) ([]*User, error) {
// sure we cannot miss users that previously existed without the deleted
// attr. Since this will only be in 2.0 that should never happen, but...
// belt and suspenders.
- query = append(query, bson.D{{"$or", []bson.D{
- {{"deleted", bson.D{{"$exists", false}}}},
- {{"deleted", false}},
- }}}...)
+ query = append(query, bson.DocElem{
+ "deleted", bson.D{{"$ne", true}},
+ })
// As above, in the case that a user previously existed and doesn't have a
// deactivated attribute, we make sure the query checks for the existence
// of the attribute, and if it exists that it is not true.
if !includeDeactivated {
- query = append(query, bson.D{{"$or", []bson.D{
- {{"deactivated", bson.D{{"$exists", false}}}},
- {{"deactivated", false}},
- }}}...)
+ query = append(query, bson.DocElem{
+ "deactivated", bson.D{{"$ne", true}},
+ })
}
iter := users.Find(query).Iter()
defer iter.Close()