Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added ability to query for what keys are in a document
Added GET-KEYS on a document. This is useful in a heterogenous
collection where different documents may need to be queried.
  • Loading branch information
pdn committed Jan 12, 2012
1 parent 90cfd35 commit 6c8c7f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/document.lisp
Expand Up @@ -58,6 +58,12 @@ the document was generated by the client (as opposed to having been read from th
(push (doc-id document) lst))
lst))

(defgeneric get-keys (document)
(:documentation "Gets a list of keys that are in the document"))
(defmethod get-keys ((document document))
(loop for key being the hash-keys of (elements document)
collect key))

(defun get-all-values (key list-of-docs)
(let ((lst ()))
(dolist (doc list-of-docs)
Expand Down
1 change: 1 addition & 0 deletions src/packages.lisp
Expand Up @@ -17,6 +17,7 @@
:ht->document
:mapdoc
:doc-id
:get-keys

;;commands
:mongo
Expand Down

0 comments on commit 6c8c7f6

Please sign in to comment.