;;; ------------------------------------------------------------ Handling ISODate(...) and ObjectId(...) forms ------------------------------------------------------------
;; In Mongo it's fairly common use ISODate(...) or ObjectId(...) forms in queries, which unfortunately are not valid JSON,
;; and thus cannot be parsed by Cheshire. But we are clever so we will:
;;; --------------------------------- Handling ISODate(...) and ObjectId(...) forms ----------------------------------
;; In Mongo it's fairly common use ISODate(...) or ObjectId(...) forms in queries, which unfortunately are not valid
;; JSON, and thus cannot be parsed by Cheshire. But we are clever so we will:
;;
;; 1) Convert forms like ISODate(...) to valid JSON forms like ["___ISODate", ...]
;; 2) Parse Normally
;; 3) Walk the parsed JSON and convert forms like [:___ISODate ...] to JodaTime dates, and [:___ObjectId ...] to BSON IDs
;; 3) Walk the parsed JSON and convert forms like [:___ISODate ...] to JodaTime dates, and [:___ObjectId ...] to BSON
;; IDs
;; See https://docs.mongodb.com/manual/core/shell-types/ for a list of different supported types
(def^:privatefn-name->decoder
...
...
@@ -398,8 +429,10 @@
(DateTime.arg))
:ObjectId(fn[^Stringarg]
(ObjectId.arg))
:Date(fn[&_]; it looks like Date() just ignores any arguments
(u/format-date"EEE MMM dd yyyy HH:mm:ss z")); return a date string formatted the same way the mongo console does
;; it looks like Date() just ignores any arguments return a date string formatted the same way the Mongo console