An "ORM" style API is built on the basic Mongo operations.
A Mongo dictionary is a dictionary backed by Mongo.
procedure
( create-mongo-dict col)→mongo-dict?
col:string?
procedure
( mongo-dict-query colquery)→(sequenceofmongo-dict? )
col:string?query:bson-document/c
procedure
( mongo-dict? x)→boolean?
x:any/c
parameter
( current-mongo-db )→(or/c false/c mongo-db? )
procedure
( mongo-dict-ref mdkey[fail])→any/c
md:mongo-dict?key:symbol?
procedure
( mongo-dict-set! mdkeyval)→void
md:mongo-dict?key:symbol?val:any/c
procedure
( mongo-dict-remove! mdkey)→void
md:mongo-dict?key:symbol?
procedure
md:mongo-dict?
procedure
( mongo-dict-inc! mdkey[amt])→void
md:mongo-dict?key:symbol?
procedure
( mongo-dict-push! mdkeyval)→void
md:mongo-dict?key:symbol?val:any/c
procedure
( mongo-dict-append! mdkeyvals)→void
md:mongo-dict?key:symbol?vals:sequence?
procedure
( mongo-dict-set-add! mdkeyval)→void
md:mongo-dict?key:symbol?val:any/c
procedure
( mongo-dict-set-add*! mdkeyvals)→void
md:mongo-dict?key:symbol?vals:sequence?
procedure
( mongo-dict-pop! mdkey)→void
md:mongo-dict?key:symbol?
procedure
( mongo-dict-shift! mdkey)→void
md:mongo-dict?key:symbol?
procedure
( mongo-dict-pull! mdkeyval)→void
md:mongo-dict?key:symbol?val:any/c
procedure
( mongo-dict-pull*! mdkeyvals)→void
md:mongo-dict?key:symbol?vals:sequence?
define-mongo-struct is a macro to create some convenience functions for Mongo dictionaries.
syntax
([fieldopt...]...))opt = #:required| #:immutable| #:ref| #:set!| #:inc| #:null| #:push| #:append| #:set-add| #:set-add*| #:pop| #:shift| #:pull| #:pull*struct : identifier?collection : string?field : identifier?
Every field implicitly has the #:ref option. Every mutable field implicitly has the #:set! option. Every immutable field implicitly has the #:required option. It is an error for an immutable field to have any options other than #:required and #:ref, which are both implicit.
make-struct takes one keyword argument per field. If the field does not have the #:required option, the argument is optional and the instance will not contain a value for the field. make-struct returns a mongo-dict? .
If a field has the #:ref option, then struct-field is defined. It is implemented with mongo-dict-ref .
If a field has the #:set option, then set-struct-field! is defined. It is implemented with mongo-dict-set! .
If a field has the #:inc option, then inc-struct-field! is defined. It is implemented with mongo-dict-inc! .
If a field has the #:null option, then null-struct-field! is defined. It is implemented with mongo-dict-remove! .
If a field has the #:push option, then push-struct-field! is defined. It is implemented with mongo-dict-push! .
If a field has the #:append option, then append-struct-field! is defined. It is implemented with mongo-dict-append! .
If a field has the #:set-add option, then set-add-struct-field! is defined. It is implemented with mongo-dict-set-add! .
If a field has the #:set-add* option, then set-add*-struct-field! is defined. It is implemented with mongo-dict-set-add*! .
If a field has the #:pop option, then pop-struct-field! is defined. It is implemented with mongo-dict-pop! .
If a field has the #:shift option, then shift-struct-field! is defined. It is implemented with mongo-dict-shift! .
If a field has the #:pull option, then pull-struct-field! is defined. It is implemented with mongo-dict-pull! .
If a field has the #:pull* option, then pull*-struct-field! is defined. It is implemented with mongo-dict-pull*! .