Skip to content

Commit

Permalink
handle “_id” filter as a special case in .notEquals case as well
Browse files Browse the repository at this point in the history
  • Loading branch information
fedefrappi committed Jan 27, 2017
1 parent 925c857 commit 73c2a80
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/Filter+MongoKitten.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ extension Fluent.Filter {
case .lessThanOrEquals:
query = key <= val
case .notEquals:
query = key != val
if key == "_id", let id = try? ObjectId(val.string ?? "") {
query = "_id" != id
} else {
query = key != val
}
case .contains:
query = MKQuery(aqt: .contains(key: key, val: val.string ?? "", options: []))
case .hasPrefix:
Expand Down

0 comments on commit 73c2a80

Please sign in to comment.