Cookies help us deliver our services. By using our services, you agree to our use of cookies. More information

Difference between revisions of "Elite Document Structure"

From NoSQLZoo
Jump to: navigation, search
 
(17 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Questions on this database can be found here [[MAPREDUCE elite|MAPREDUCE elite]]
+
Questions on this database can be found here: [[MAPREDUCE elite]]
==Document Structure==
+
==Elite Dangerous==
 
Keys used in this database.
 
Keys used in this database.
 
<pre>
 
<pre>
 
     commodities:  
 
     commodities:  
 
         _id, average_price, category, name
 
         _id, average_price, category, name
 +
 
     systems:  
 
     systems:  
 
         _id, allegiance, faction, government, name, population, primary_economy, security, state, stations, updated_at, x, y, z
 
         _id, allegiance, faction, government, name, population, primary_economy, security, state, stations, updated_at, x, y, z
Line 16: Line 17:
 
          
 
          
 
</pre>
 
</pre>
Unlike the <code>world</code> collection, <code>null</code> and empty values are no longer stored in this database.<br/>
+
Unlike the '''world''' collection, <syntaxhighlight lang="JavaScript" inline>null</syntaxhighlight> and empty values are not stored in this database.<br/>
This means that some documents will have fields that others do not: Some systems will be uninhabited and have no stations. Some stations will have no listings.<br/>
+
This means that some documents will have fields that others do not. Some systems will be uninhabited and have no stations and some stations will have no listings.<br/><br/>
To query null <b>or</b> non-existant fields we use <code><field>: null</code><br/><br/>
+
To query <syntaxhighlight lang="JavaScript" inline>null</syntaxhighlight> '''or''' non-existent fields use <syntaxhighlight lang="JavaScript" inline><field>: None</syntaxhighlight>. or <syntaxhighlight lang="JavaScript" inline><field>: "null"</syntaxhighlight><br/><br/>
The average <code>commodities</code> document looks something like this.
+
A typical <code>commodities</code> document looks something like this.
<pre>
+
<syntaxhighlight lang="JavaScript">
 
{
 
{
 
         "_id" : ObjectId("55af74e7402aa43f1ce7e3a3"),
 
         "_id" : ObjectId("55af74e7402aa43f1ce7e3a3"),
Line 27: Line 28:
 
         "category" : "Chemicals"
 
         "category" : "Chemicals"
 
}
 
}
</pre>
+
</syntaxhighlight>
<code>systems</code> is much bigger, so some stations and listings have been removed from this example<div class=hint title="click here to show it.">
+
'''systems''' is much bigger, so some stations and listings have been removed from this example document to make it shorter.
<pre>
+
*The system '''Kappa Cygni''' has two stations '''Kensey Ring''' and '''Hauck Enterprise'''.
> db.systems.findOne({"name":"1 Kappa Cygni"})
+
*At Kensey Ring you can buy the commodity '''Hydrogen Fuel''' for 93 credits per ton, you can sell it is 89 credits.
 +
*You cannot buy '''Mineral Oil''' there but you can sell it at 326.
 +
<syntaxhighlight lang="JavaScript">
 +
> db.systems.findOne({"name":"1 Kappa Cygni"}) // Query
 +
 
 +
// Result
 
{
 
{
         "_id" : ObjectId("55b0e227369fd571eca8764c"),
+
         "_id" : ObjectId("55b0edf6369fd5074b349c48"),
 
         "stations" : [
 
         "stations" : [
 
                 {
 
                 {
Line 41: Line 47:
 
                         "has_outfitting" : 0,
 
                         "has_outfitting" : 0,
 
                         "government" : "Democracy",
 
                         "government" : "Democracy",
                        "state" : null,
 
 
                         "has_shipyard" : 0,
 
                         "has_shipyard" : 0,
 
                         "type" : "Unknown Outpost",
 
                         "type" : "Unknown Outpost",
Line 66: Line 71:
 
                                         "sell_price" : 326,
 
                                         "sell_price" : 326,
 
                                         "demand" : 217674
 
                                         "demand" : 217674
                                 },
+
                                 }
 
                         ],
 
                         ],
 
                         "distance_to_star" : 2359,
 
                         "distance_to_star" : 2359,
Line 76: Line 81:
 
                 },
 
                 },
 
                 {
 
                 {
                         "max_landing_pad_size" : "L",
+
                         "max_landing_pad_size" : "M",
 
                         "has_blackmarket" : 1,
 
                         "has_blackmarket" : 1,
 
                         "has_commodities" : 0,
 
                         "has_commodities" : 0,
 
                         "updated_at" : 1434929486,
 
                         "updated_at" : 1434929486,
                         "has_outfitting" : 1,
+
                         "has_outfitting" : 0,
                         "government" : "Democracy",
+
                         "government" : "Anarchy",
                        "state" : null,
+
                         "has_shipyard" : 0,
                         "has_shipyard" : 1,
+
                         "type" : "Unknown Outpost",
                         "type" : "Unknown Starport",
 
 
                         "has_rearm" : 1,
 
                         "has_rearm" : 1,
                         "allegiance" : "Federation",
+
                         "allegiance" : "Independent",
 
                         "has_refuel" : 1,
 
                         "has_refuel" : 1,
                         "name" : "Wohler Port",
+
                         "name" : "Hauck Enterprise",
                         "distance_to_star" : 3520,
+
                         "distance_to_star" : 4832,
 
                         "economies" : [
 
                         "economies" : [
 
                                 "Industrial",
 
                                 "Industrial",
Line 111: Line 115:
 
         "population" : 24843190
 
         "population" : 24843190
 
}
 
}
 
+
</syntaxhighlight>
</pre>
 
</div>
 

Latest revision as of 13:55, 17 October 2018

Questions on this database can be found here: MAPREDUCE elite

Elite Dangerous

Keys used in this database.

    commodities: 
        _id, average_price, category, name

    systems: 
        _id, allegiance, faction, government, name, population, primary_economy, security, state, stations, updated_at, x, y, z

    systems.stations: 
        allegiance, distance_to_star, economies, export_commodities,has_blackmarket, has_commodities, has_rearm, has_repair,
        has_shipyard, has_outfitting, faction, government, listings, max_landing_pad, name, state, type, updated_at

    systems.stations.listings: 
        buy_price, collected_at, demand, commodity, sell_price, supply, update_count
        

Unlike the world collection, null and empty values are not stored in this database.
This means that some documents will have fields that others do not. Some systems will be uninhabited and have no stations and some stations will have no listings.

To query null or non-existent fields use <field>: None. or <field>: "null"

A typical commodities document looks something like this.

{
        "_id" : ObjectId("55af74e7402aa43f1ce7e3a3"),
        "name" : "Explosives",
        "average_price" : 267,
        "category" : "Chemicals"
}

systems is much bigger, so some stations and listings have been removed from this example document to make it shorter.

  • The system Kappa Cygni has two stations Kensey Ring and Hauck Enterprise.
  • At Kensey Ring you can buy the commodity Hydrogen Fuel for 93 credits per ton, you can sell it is 89 credits.
  • You cannot buy Mineral Oil there but you can sell it at 326.
> db.systems.findOne({"name":"1 Kappa Cygni"}) // Query

// Result
{
        "_id" : ObjectId("55b0edf6369fd5074b349c48"),
        "stations" : [
                {
                        "max_landing_pad_size" : "M",
                        "has_blackmarket" : 0,
                        "has_commodities" : 1,
                        "updated_at" : 1434929486,
                        "has_outfitting" : 0,
                        "government" : "Democracy",
                        "has_shipyard" : 0,
                        "type" : "Unknown Outpost",
                        "has_rearm" : 0,
                        "allegiance" : "Federation",
                        "has_refuel" : 1,
                        "name" : "Kinsey Ring",
                        "listings" : [
                                {
                                        "commodity" : "Hydrogen Fuel",
                                        "supply" : 129630,
                                        "collected_at" : 1421669319,
                                        "update_count" : "1",
                                        "buy_price" : 93,
                                        "sell_price" : 89,
                                        "demand" : 0
                                },
                                {
                                        "commodity" : "Mineral Oil",
                                        "supply" : 0,
                                        "collected_at" : 1421669320,
                                        "update_count" : "1",
                                        "buy_price" : 0,
                                        "sell_price" : 326,
                                        "demand" : 217674
                                }
                        ],
                        "distance_to_star" : 2359,
                        "economies" : [
                                "Industrial",
                                "Refinery"
                        ],
                        "has_repair" : 1
                },
                {
                        "max_landing_pad_size" : "M",
                        "has_blackmarket" : 1,
                        "has_commodities" : 0,
                        "updated_at" : 1434929486,
                        "has_outfitting" : 0,
                        "government" : "Anarchy",
                        "has_shipyard" : 0,
                        "type" : "Unknown Outpost",
                        "has_rearm" : 1,
                        "allegiance" : "Independent",
                        "has_refuel" : 1,
                        "name" : "Hauck Enterprise",
                        "distance_to_star" : 4832,
                        "economies" : [
                                "Industrial",
                                "Refinery"
                        ],
                        "has_repair" : 1
                }
        ],
        "name" : "1 Kappa Cygni",
        "faction" : "United 1 Kappa Cygni Future",
        "government" : "Democracy",
        "allegiance" : "Federation",
        "updated_at" : 1430938622,
        "state" : "None",
        "needs_permit" : 0,
        "y" : 37.78125,
        "x" : -117.75,
        "security" : "High",
        "z" : 11.1875,
        "primary_economy" : "Industrial",
        "population" : 24843190
}