Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to work with modern MongoDB #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/map-reduce.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
mongo map reduce
|#

(defmacro $map-reduce (collection map reduce &key (query nil) (limit 0) (out nil)
(defmacro $map-reduce (collection map reduce &key (query nil) (limit nil) (out nil)
(keeptemp nil) (finalize nil) (verbose t))
"Run map reduce on the mongo server. map and reduce are either the names of the
javascript functions, created with defjs or defsrvjs or are function definitions in javascript.
Expand All @@ -16,8 +16,7 @@ When using :keeptemp t without specificing :out the collection is mr.<collection
(when ,finalize (kv "finalize" (jsdef ,finalize)))
(kv "out" (if ,out ,out (concatenate 'string "mr." ,collection)))
(kv "verbose" ,verbose)
(kv "limit" ,limit)
(kv "keeptemp" ,keeptemp)
(when ,limit (kv "limit" ,limit))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • "keeptemp" is apparently no longer supported in calls to MongoDB's mapReduce.
  • "limit" is apparently no longer allowed to be zero in calls to MongoDB's mapReduce.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, 0 is "true" in CL, so perhaps (unless (zerop limit) ...) or (when (> limit 0) ...) ?

(kv "query" ,query))))

(defun mr.p (results)
Expand Down