Skip to content
This repository

Fix some more documentation #5

Merged
merged 4 commits into from about 2 years ago

2 participants

Russell Smith Christian Amor Kvalheim
Russell Smith
ukd1 commented April 14, 2012

I've fixed gen_docs - this was broken unless you'd installed bson separately.

Renamed the design doc to be something sensible - also updated all the comments to point to the correct place (official mongodb repo). Added a link to the documentation on the bottom.

Removed a redundant document.

Christian Amor Kvalheim christkv merged commit 386130c into from April 14, 2012
Christian Amor Kvalheim christkv closed this April 14, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
13  doc/Article1.md → doc/design.md
Source Rendered
... ...
@@ -1,11 +1,11 @@
1 1
 # Design of the Erlang MongoDB driver
2 2
 #### By Tony Hannan, June 2011
3 3
 
4  
-I am a 10gen employee an author of the official [Erlang MongoDB driver](http://github.com/TonyGen/mongodb-erlang). In Nov 2010, I was assigned the task of writing a production-quality Erlang driver. Today, I would say the official driver is production-quality. Below I highlight some design decisions. For detailed documentation with code examples please see the links at the end of this article.
  4
+I am a 10gen employee an author of the official [Erlang MongoDB driver](http://github.com/mongo/mongodb-erlang). In Nov 2010, I was assigned the task of writing a production-quality Erlang driver. Today, I would say the official driver is production-quality. Below I highlight some design decisions. For detailed documentation with code examples please see the links at the end of this article.
5 5
 
6 6
 ### BSON
7 7
 
8  
-At the highest level, the driver is divided into two library applications, [mongodb](http://github.com/TonyGen/mongodb-erlang) and [bson](http://github.com/TonyGen/bson-erlang). Bson is defined independently of MongoDB at [bsonspec.org](http://bsonspec.org). One design decision was how to represent Bson documents in Erlang. Conceptually, a document is a record, but unlike an Erlang record, a Bson document does not have a single type tag. Futhermore, the same MongoDB collection can hold different types of records. So I decided to represent a Bson document as a tuple with labels interleaved with values, as in `{name, Name, address, Address}`. An alternative would have been to represent a document as a list of label-value pairs, but I wanted to reserve lists for Bson arrays.
  8
+At the highest level, the driver is divided into two library applications, [mongodb](http://github.com/mongodb/mongodb-erlang) and [bson](http://github.com/mongodb/bson-erlang). Bson is defined independently of MongoDB at [bsonspec.org](http://bsonspec.org). One design decision was how to represent Bson documents in Erlang. Conceptually, a document is a record, but unlike an Erlang record, a Bson document does not have a single type tag. Futhermore, the same MongoDB collection can hold different types of records. So I decided to represent a Bson document as a tuple with labels interleaved with values, as in `{name, Name, address, Address}`. An alternative would have been to represent a document as a list of label-value pairs, but I wanted to reserve lists for Bson arrays.
9 9
 
10 10
 A Bson value is one of several types. One of these types is the document type itself, making it recursive. Several value types are not primitive, like objectid and javascript, so I had to create a tagged tuple for each of them. I defined them all to have an odd number of elements to distinguish them from a document which has an even number of elements. Finally, to distinguish between a string and a list of integers, which is indistinguishable in Erlang, I require Bson strings to be binary (UTF-8). Therefore, a plain Erlang string is interpreted as a Bson array of integers, so make sure to always encode your strings, as in `<<"hello">>` or `bson:utf8("hello")`.
11 11
 
@@ -23,4 +23,11 @@ You may notice that a DB action is analogous to a DB transaction for a relationa
23 23
 
24 24
 ### Documentation
25 25
 
26  
-Detailed documentation with examples can be found in the ReadMe's of the two libraries, [mongodb](http://github.com/TonyGen/mongodb-erlang) and [bson](http://github.com/TonyGen/bson-erlang), and in their source code comments and test modules.
  26
+Detailed documentation with examples can be found in the ReadMe's of the two libraries, [mongodb](http://github.com/mongodb/mongodb-erlang) and [bson](http://github.com/mongodb/bson-erlang), and in their source code comments and test modules.
  27
+
  28
+In addition recent docuemenation on the API will be avaliable on the [mongodb website](http://api.mongodb.org/erlang/mongodb/).
  29
+
  30
+Should you wish to generate this from the latest code, you can run:
  31
+
  32
+    $ cd docs
  33
+    $ sh ./gen_docs
5  doc/gen_docs
... ...
@@ -1,3 +1,6 @@
1 1
 #!/bin/sh
2 2
 # Generate html docs from src code comments using edoc
3  
-erl -pa ../../bson/ebin/ ../../mongodb/ebin -eval 'edoc:application (mongodb, [{index_columns, 1}, {sort_functions, false}, {preprocess, true}]), init:stop()' -noshell
  3
+#
  4
+# Note; this requires you to have already run make
  5
+#
  6
+erl -pa ../deps/bson/ebin ../../mongodb/ebin -eval 'edoc:application (mongodb, [{index_columns, 1}, {sort_functions, false}, {preprocess, true}]), init:stop()' -noshell
2  doc/overview.edoc
... ...
@@ -1,2 +0,0 @@
1  
-@doc
2  
-See <a href="http://github.com/TonyGen/mongodb-erlang#readme">ReadMe</a> for overview.
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.