On this page:
3.1 Queries
3.2 Keys in documents
3.3 Names issues
3.4 Troubles

3 Various comments

3.1 Queries

You can find out about BSON

Current query syntax is cons-format syntax used in MongoDB module. It looks neatly but has some restrictions. So:

BSON structures are documents/dictionaries/hashes and lists/arrays. Working with BSON objects/queries you can use hashes + lists or just lists to describe them.

Writing BSON objects/queries in lists:
  • lists: '(1 2 3) or (list 1 2 3)

  • hashes: '((a . 1) (b . 2)) or (list (cons 'a 1) (cons 'b 2))

bnf style:
  query = dictionary
     
  dictionary = 
  | [dictionary-key content] ...
     
  dictionary-key = symbol?
     
  list = 
  | content ...
     
  content = list
  | dictionary
  | other-types-of-BSON-value

Therefor ((a 1 2 3)) is a hash that containes key a with value (1 2 3). It is equal to result of (list (cons 'a (list 1 2 3))) or (list (list 'a 1 2 3)) expression.

Restrictions is that you can not describe list of lists properly with this rules. Query '((a (b c) (d e))) is properly notation of {a : [["b", "c"], ["d", "e"]]} and {a : {b : "c", d : "e"}} objects following current rules. The only way to solve this - use hashes.

3.2 Keys in documents

Currently used as base, module MongoDB requires all keys in queries and objects to be symbol?. So if you need to specify sofisticated key use |expression|. For example key "123 qwe" can be refered as '|123 qwe|.

3.3 Names issues

Mongo collection created in plt with name "something-something" will be unreachable in MongoDB native console through default notation db.something-something.find() because of - symbol. Use db["something-something"].find() form instead.

3.4 Troubles

If you encounter error make-hasheq: expects no arguments, given 1: ((1 . function) (2 . binary) (3 . uuid) (5 . md5) (128 . user-defined)) look for README.txt in package folder.