Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/bson-decode.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
(size (if (eql type #x02)
(octet-to-int32.1 array (+ pos 5))
(octet-to-int32.1 array pos)))
(offset (if (eql type #x02) 9 5))
(offset (+ pos (if (eql type #x02) 9 5)))
(binary (bson-binary type (subseq array offset (+ offset size)))))
(setf (gethash key ht) binary)
(incf pos totalsize)))
Expand Down
2 changes: 1 addition & 1 deletion src/bson.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
(add-octets (byte-to-octet (type-id value)) array)
(add-octets (int32-to-octet (length (data value))) array)
(add-octets (data value) array)))
(bson-encode key value :array array :type type :encoder #'encode-value))))
(call-next-method key value :array array :type type :encoder #'encode-value))))

;
; The array type is the parent class of other types like string. So see if a type and encoder is
Expand Down
3 changes: 2 additions & 1 deletion src/db.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ Create an index specified by the keys in a collection
(kv (kv "ns" (full-collection-name mongo collection))
(kv "key" (force-float index))
(spec-gen unique drop-duplicates)
(kv "name" (keys->name (ht->list index))))))))
(kv "name" (keys->name (ht->list index))))
:mongo mongo))))

(defmethod db.ensure-index ((collection string) (index kv-container)
&key (mongo (mongo)) (unique nil) (drop-duplicates nil))
Expand Down
6 changes: 3 additions & 3 deletions src/shell.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
shell commands
|#

(defun docs (result)
(defun docs (result &key (mongo (mongo)))
"Stop the iterator (if any) and return the list of documents returned by the query.
Typical ue would be in conjunction with db.find like so (docs (iter (db.find 'foo' 'll)))"
(cadr (db.stop result)))
Typical use would be in conjunction with db.find like so (docs (iter (db.find 'foo' 'll)))"
(cadr (db.stop result :mongo mongo)))

(defun iter (result &key (mongo (mongo)) (max-per-call 0))
"Exhaustively iterate through a query. The maximum number of responses
Expand Down