Working with AliasesΒΆ

Sometimes field names are abbreviated and thus hard to understand when looking at a JSON document or results of a query. This is often done to preserve space since field names are not compressed (compression will be added to MongoDB in a future release but at this time it is not yet supported). You can define aliases within the tool and then results will be displayed with the field name and the alias name to facilitate descriptive labels.

Aliases are defined using the Aliases link at the top right of most JSON Studio applications. To add a new alias click on the + link and add the name and the value as shown in the image below. Aliases can be saved and loaded to the Studio db (in the lmrm__aliases collection) to persist the data across session and can be exported and imported.

Adding an alias means that when the field is displayed, both the field name and the alias are shown (the alias is in parentheses as shown below). You can control whether or not aliases are shown using the preferences.

_images/alias1.jpg

An alias name is a string that is used to match a field name - not a dot notation. As an example, if you define an alias for the field name d and give is an alias DATE it will match all the “d” field in all sub-levels as shown below (assume also that an alias is defined for sub2 with a value of “DATE TIME”):

{
"d(DATE)": 20140204,
"sub1":
   {
   "d(DATE)": 20140204,
   "sub2(DATE TIME)":
      {
      "d(DATE)": 20140204
      "t": "18:35:59"
      }
   }
}

An alias is normally a global description - e.g. the alias DATE for the field d will annotate any field d in any collection. If you want an alias to annotate only a certain collection use the format <collection name>.<field name> for the alias name. For example, in the image above field9 will be annotated with the string BROWSER in all collections but field7 will be annotated with the string LANGUAGE only in the hits collection. Note that alias names do not support dot notation - e.g. in the example immediately above you cannot specify an alias that will annotate only sub1.sub2.d but not sub1.d and d at the top-level of the document. The advantage of this approach is that you just need to specify the annotation once and it will apply to all levels of containment.

Table Of Contents

Previous topic

jSonarR - Using Gateway data from within R

Next topic

Resource Management and Indexes

Copyright © 2013-2016 jSonar, Inc
MongoDB is a registered trademark of MongoDB Inc. Excel is a trademark of Microsoft Inc. JSON Studio is a registered trademark of jSonar Inc. All trademarks and service marks are the property of their respective owners.