@@ -56,8 +56,11 @@ types. An example collection map might be:
56
56
- id:
57
57
:source: _id
58
58
:type: TEXT
59
- - author:
60
- :source: author
59
+ - author_name:
60
+ :source: author.name
61
+ :type: TEXT
62
+ - author_bio:
63
+ :source: author.bio
61
64
:type: TEXT
62
65
- title: TEXT
63
66
- created: DOUBLE PRECISION
@@ -79,9 +82,15 @@ describing that column. This hash may contain the following fields:
79
82
* ` :source ` : The name of the attribute inside of MongoDB.
80
83
* ` :type ` : (Mandatory) The SQL type.
81
84
82
- This syntax allows to rename MongoDB's attributes during the
83
- import. For example the MonogDB ` _id ` attribute will be transferred to
84
- a SQL column named ` id ` .
85
+
86
+ Use of the ` :source ` attribute allows for renaming attributes, and
87
+ extracting elements of a nested hash using MongoDB's
88
+ [ dot notation] [ dot-notation ] . In the above example, the ` name ` and
89
+ ` bio ` fields of the ` author ` sub-document will be expanded, and the
90
+ MongoDB ` _id ` field will be mapped to an SQL ` id ` column.
91
+
92
+ At present, MoSQL does not support using the dot notation to access
93
+ elements inside arrays.
85
94
86
95
As a shorthand, you can specify a one-elment hash of the form `name:
87
96
TYPE` , in which case ` name` will be used for both the source attribute
@@ -100,6 +109,8 @@ By default, `mosql` looks for a collection map in a file named
100
109
` collections.yml ` in your current working directory, but you can
101
110
specify a different one with ` -c ` or ` --collections ` .
102
111
112
+ [ dot-notation ] : http://docs.mongodb.org/manual/core/document/#dot-notation
113
+
103
114
## Usage
104
115
105
116
Once you have a collection map. MoSQL usage is easy. The basic form
0 commit comments