1 Quickstart

Here’s a little snippet that uses the API.

(define m (create-mongo))
(define d (make-mongo-db m "awesome-dot-com"))
(current-mongo-db d)
(define-mongo-struct post "posts"
  ([title #:required]
   [body #:required]
   [tags #:set-add #:pull]
   [comments #:push #:pull]
   [views #:inc]))
 
(define p
  (make-post #:title "Welcome to my blog"
             #:body "This is my first entry, yay!"))
(set-add-post-tags! p 'awesome)
(inc-post-views! p)
 
(set-post-comments! p (list "Can't wait!" "Another blog?"))
(post-comments p)
 
var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?f1ba5b4a33d29d84db69f029b9ace483"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();