Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added routine to query a document for keys. #6

Merged
merged 1 commit into from

2 participants

@pnathan

Commit message: Added GET-KEYS on a document. This is useful in a heterogenous
collection where different documents have different keys and each may need to be queried and action dispatched separately.

I see it as similar to the function ALEXANDRIA:HASH-TABLE-KEYS.

@pnathan pnathan 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.
6c8c7f6
@fons fons merged commit b1d5900 into from
@fons
Owner

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 12, 2012
  1. @pnathan

    Added ability to query for what keys are in a document

    pnathan authored
    Added GET-KEYS on a document. This is useful in a heterogenous
    collection where different documents may need to be queried.
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 0 deletions.
  1. +6 −0 src/document.lisp
  2. +1 −0  src/packages.lisp
View
6 src/document.lisp
@@ -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)
View
1  src/packages.lisp
@@ -17,6 +17,7 @@
:ht->document
:mapdoc
:doc-id
+ :get-keys
;;commands
:mongo
Something went wrong with that request. Please try again.