league ▼ Rink Repairs Warm Welcome Goalie vs Team 3D Goals Toronto Love teams ▼ Empty Net Performance Team icings Offsides Leading/Trailing Strikebacks Playoff Success Schedule breaks Buchholz & Berger Early Relaxation Give or Take Delayed Penalties players ▼ Icings Plus/Minus Clutch Players Deadly Pairs Frequent Dancers Penalty Killers Powerless Streak coaches ▼ Coach PO Success Coach Face2Face Challenge Success Bench management drafts ▼ Roster Talent Talent Management Pick Stats Pick Success data ▼ Software Sources Analysis API Files
API
Donate
Data>
Software
Sources
Analysis
API
Files

MoreHockeyStats API documentation


Getting Started API conversation Our Collections Collection Filters Apply!

This document describes the API to the database of MoreHockeyStats. You can query any of our websites (morehockeystats.com, hockeyeloratings.com, nhlerrata.com) with this API, they are all powered by the same database.

Getting Started

The database itself is a MongoDB, and the API emulates a limited MongoDB client, with a subset of features for query and count of the fields. The data returned is a JSON object as returned by the database query.

Our data is run through a large list of tests to verify its validity, and although we cannot guarantee a 100% correctness, we consider the data to be of high quality. We perform a set of automatic data corrections described on our site NHL Errata.

Some of the data is free, but some requires payment to access. The charge on the queries is always by the amount of records retrieved. Only authorized users can access the database. If you prefer to work with the free publicly available data, you may choose to do so via pseudo-API queries of the website as described in the 'JSON' and 'CSV' links under each table. Running this site comes at a cost, and providing this kind of premium access is a way we hope to recoup some of this cost. We also supply tool to estimate the query costs before the queries are being executed. We do not provide live updates of the collections! All data is updated during a nightly run.

The query is performed by executing an HTTP Post at the API URL. The exchange is straightforward:

Sample conversation.

Let's assume file post.json with the following simple query:

{
        "user": "morehockeystats",
        "pass": "deadbeef",
        "query" : {
                "type": "find",
                "collection" : "coaches",
                "filter" : {
			 "team" : "ARI"
                },
                "fields" : {
                        "name": 1,
                }
        }
}

The fields user and pass are your API username and passwords. You can apply for one by contacting us via email or Twitter. Then there's the actual query JSON, which, in this case, is a query to find all coaches of the Arizona Coyotes franchise and return the field of the coach's name.

We execute the query with the help of wget:

wget -q -O- --post-file post.json https://morehockeystats.com/api

Here's the response to this query (pretty-formatted):

{
	"count": 9,
	"cost": 0,
	"data":[
		{
			"_id":"5b6e99e99ad6905c880b8928",
			"name":"DAN MALONEY"
		},
		{
			"_id":"5b6e99bf9ad6905c880b8746",
			"name":"BOB MURDOCH"
		},
		{
			"_id":"5b6eb4ae9ad6905c881110ee",
			"name":"BOB FRANCIS"
		},
		{
			"_id":"5b6e99af9ad6905c880b86f1",
			"name":"TERRY SIMPSON"
		},
		{
			"_id":"5b6e9ae29ad6905c880bcce0",
			"name":"JIM SCHOENFELD"
		},
		{
			"_id":"5b6e9d229ad6905c880c4dea",
			"name":"RICK BOWNESS"
		},
		{
			"_id":"5b6f6a4a9ad6907cd25ece14",
			"name":"WAYNE GRETZKY"
		},
		{
			"_id":"5b6f5e029ad6907cd2577f01",
			"name":"DAVE TIPPETT"
		},
		{
			"_id":"5b6fb9c49ad6900d2b347bfa",
			"name":"RICK TOCCHET"
		}
	],
	"status":201
}

Each response contains a status code. Here's the list of the status codes and their meanings. If the status code indicates an error, there will be an error field in the JSON, describing the error. The _id fields contain the MongoDB BSON OIDs. Their usage and importance will be described below.

There are no rate limitations in this API, but we reserve the right to block the clients and the users that seem to be abusing the resource.

Please consult a variety of resources on MongoDB, including Mongo's own Getting Started for more information, and as a complement to the reading below. Please note that MoreHockeyStats is currently using MongoDB v3.4.

API conversation
General structure

The query JSON posted to the server must have the following fields:

  • user - your API user
  • pass - your API password
  • query - the structure of your query with the mandatory sub-field type, with one of the following values:
    • status: status of the API account, including the balance
    • list: list of the collections available for query
    • fields: list of the fields available for filtering the query on a given collection
    • count: get the expected count of documents for the given query
    • find: execute the query

Status query:
Type: status
Additional fields: none
Executes the query on the API account returning its data:
  • user - username
  • balance - account balance
  • queries - number of queries executed
  • records - number of records retrieved
  • status - user status, currently: active|inactive
  • history - history of the find transactions:
    • collection - the collection queried
    • cost - the cost of the query
    • records - the number of records retrieved in the query
Example:
> cat status.json 
{
	"user": "morehockeystats",
	"pass": "deadbeef",
	"query": {
		"type": "status"
	}
}
> wget -q -O- --post-file status.json https://morehockeystats.com/api
{
   "cost" : 0,
   "data" : {
      "queries" : 2,
      "user" : "morehockeystats",
      "records" : 12,
      "history" : [
         {
            "collection" : "coaches",
            "records" : 9,
            "cost" : 0
         },
         {
            "cost" : 0.03,
            "records" : 3,
            "collection" : "MISS"
         }
      ],
      "status" : "active",
      "balance" : "9.97"
   },
   "status" : 201
}
List query:
Type: list
Additional fields: none
Lists the collections available for the query and some initial data about them:
  • name - collection name to use in future queries
  • cost - cost per record to be deducted from your balances. 0 means free.
  • since - earliest season featuring in the collection
  • updated - update frequency, one of
    • 1 - daily
    • 2 - weekly
    • 3 - monthly
    • 4 - yearly
    • 5 - manually
  • type - type of the collection, one of
    • events - events of a certain type
    • games - games or schedules
    • league - league-wide data
    • people - collections of people (players, coaches)
    • catalog - vocabularies and id-to-name mappings used in other collections
  • count - total number of records in the collection.
  • description - description of the collection.
Example:
> cat list.json 
{
	"user": "morehockeystats",
	"pass": "deadbeef",
	"query": {
		"type": "list"
	}
}
> wget -q -O- --post-file list.json https://morehockeystats.com/api
{
   "status" : 201,
   "cost" : 0,
   "data" : [
      {
         "type" : "events",
         "updated" : 1,
         "name" : "BLOCK",
         "cost" : 0.01,
         "since" : 2005,
         "count" : 472473,
         "description" : "Blocked shot events"
      },
      {
	…
      },
      …
   ]
}

The detailed list of the collection is available below

Fields query
Type: fields
Additional fields: collection

Lists the fields from the collection that are available to use in filtering. These are also the fields that will be returned for a successful query.

The list of the fields vary between collection to collection. Most of the fields for the query are mere scalar values and can be queried for these values or ranges of values. Some, though, are complex, contain substructures that can be queried by the subfields. These structures will be marked by a special notation and described in the complete fields reference below.

Example:
> cat fields.json 
{
	"user": "morehockeystats",
	"pass": "deadbeef",
	"query": {
		"type": "fields",
		"collection": "schedule"
	}
}
> wget -q -O- --post-file fields.json https://morehockeystats.com/api
{
   "status" : 201,
   "cost" : 0,
   "data" : [
      "away",
      "date",
      "game_id",
      "home",
      "season",
      "stage",
      "ts",
      "year"
   ]
}
Count query
Query type: count
Additional fields: collection, filter(optional)

Counts the number of records that fit the given filter constructed from the fields of the list in the previous section. It's very useful to run before a massive query to realize how much cost it's going to incur.

The returned stricture has the following fields:
  • status - 201 for success, variety of 5xx for failures.
  • count - the number of matching records.
  • cost - the expected cost of retrieval of these records.

If the query filter is omitted, returns the count of all records in the collection.

Example:
> cat count.json 
{
	"user": "morehockeystats",
	"pass": "deadbeef",
	"query": {
		"type": "count",
		"collection": "SHOT",
		"filter" : {
			"season": 2017,
			"team1": "WSH"
		}
	}
}
> wget -q -O- --post-file count.json https://morehockeystats.com/api
{
   "count" : 2804,
   "cost" : 28.04,
   "status" : 201
}

The above query returns the number of SHOT records for the team Washington Capitals in the 2017/18 season.

Find query
Query type: find
Additional fields: collection, filter (optional), fields (optional), sort (optional), limit (optional)

Queries the collection for the records that answer the optional query filter, returning the particular fields if specified, sorting the documents by a field if specified, limiting the number of records returned if specified.

Here, for a change, we start with the example.

Example:
> cat find.json 
{
	"user": "morehockeystats",
	"pass": "deadbeef",
	"query" : {
		"type": "find",
		"collection" : "MISS",
		"filter" : { 
			"$and": [ 
				{ "season" : 2017 },
				{ "player1": 8471214 }
			]
		},
		"fields" : {
			"team1": 1,
			"distance" : 1,
			"team2": 1
		},
		"sort" : {
			"distance": 1
		},
		"limit" : 3
	}
}
> wget -q -O- --post-file find.json https://morehockeystats.com/api
{
   "status": 201,
   "cost" : 0.03,
   "count" : 3,
   "data" : [
      {
         "distance" : 5,
         "_id" : 2017205020017,
         "team2" : "ANA",
         "team1" : "WSH"
      },
      {
         "distance" : 6,
         "_id" : 2017209130265,
         "team2" : "BUF",
         "team1" : "WSH"
      },
      {
         "team1" : "WSH",
         "team2" : "PIT",
         "_id" : 2017200470295,
         "distance" : 8
      }
   ]
}
> 

This query returns the three closest misses by shooting distance Alex Ovechkin (ID 8471214) ihad n the 2017 season.

The collection MISS indicates we're searching the collection of missed shots. The filter is a combination ($and, in fact a redundant one) of the season (2017) and Ovechkin's NHL Id, used as the player firing the missing shot player1: 8471214. The fields key indicate return of the team1 (Ovechkin's team), team2 (the team against which the missed shot occurred), and the distance of the shot as specified in the NHL's play by play. The sort key indicates the sorting key: 1 means ascending, -1 means descending. There is no preset order in which sorting of multiple keys will apply unless you format your sorting criteria as:

"sort" : [
       { "key1": 1|-1 },
       { "key2": 1|-1 },
]
but it is not supported yet.

The limit value 3 specifies how many records need to be returned.

The returned data also contains the original _id field with which the record is stored in the Mongo database. Sometimes you will need these _id values for fields such as catalogs. You can explicitly prohibit the _id field from being returned by adding _id: -1 in the fields section. By specifying additional fields with values of -1 you can exclude them while still returning all the remaining available fields. This applies both to scalar and to complex fields.

Our Collections

We are providing the following collections for your queries.
Note: prior to 2007 the collections have less information about each event.
Note: for the item's structure please see the filters section.

BLOCK
CHL
FAC
GEND
GIVE
GOAL
HIT
MISS
PEND
PENL
PSTR
SHOT
STOP
TAKE
challenges
coaches
common_games
conferences
divisions
games
locations
misses
penalties
players
schedule
seasons
shot_types
stopreasons
strengths"
teams
zones

Below are the descriptions and the examples of entries in each collection.

BLOCK
Entry as returned by the list command:
      {
         "name" : "BLOCK",
         "cost" : 0.01,
         "since" : 2005,
         "description" : "Blocked shot events",
         "type" : "events",
         "count" : 472473,
         "updated" : 1
      },

The collection contains blocked shot events, the query cost is $0.01 per returned event, it is available since 2005, the collection is of type events, there are currently 472473 events in the collection and it is updated daily.

CHL
Entry as returned by the list command:
      {
         "name" : "CHL",
         "cost" : 0.01,
         "since" : 2015,
         "type" : "events",
         "description" : "Challenge events, home, visitor and league",
         "updated" : 1,
         "count" : 658
      },

The collection contains the CHL (challenge) events as reported by the live JSON and/or the PBP HTML report. Some challenges are missed and are only reported as STOP events. This collection largely overlaps with the challenges collection (see below) and the latter one is more recommended for use. It costs $0.0.1 per item, it's of type events, and it is updated daily since 2015, when challenges were introduced.

FAC
Entry as returned by the list command:
      {
         "since" : 2002,
         "cost" : 0.01,
         "name" : "FAC",
         "count" : 1168365,
         "updated" : 1,
         "description" : "Faceoff events",
         "type" : "events"
      },

The collection contains the faceoff events. It's available since 2002 and costs $0.01 per item to retrieve. It's updated daily and is one of the largest collections with over 1 million of events, updated daily.

GEND
Entry as returned by the list command:
      {
         "count" : 60141,
         "updated" : 1,
         "description" : "Game End events",
         "type" : "events",
         "cost" : 0.01,
         "since" : 1917,
         "name" : "GEND"
      },

The collection contains Game End events. Although they began only to appear since 2007 in the Play By Play HTML, we generate such one for every game since 1917 and append it to the game event list. It costs $0.01/item to retrieve and there are the same number of such events as the games, updated daily.

GIVE
Entry as returned by the list command:
      {
         "count" : 294319,
         "updated" : 1,
         "description" : "Giveaway events",
         "type" : "events",
         "cost" : 0.01,
         "since" : 2005,
         "name" : "GIVE"
      },

The collection contains Giveaway events. They are available since 2005. The Giveaway statistic is not considered to be recorded reliably and consistently. It costs $0.01/item to retrieve and it is, updated daily.

GOAL
Entry as returned by the list command:
      {
         "updated" : 1,
         "count" : 367861,
         "type" : "events",
         "description" : "Goal scoring events",
         "cost" : 0.01,
         "since" : 1917,
         "name" : "GOAL"
      },

The collection contains Goal events. They are available since the start of the league in 1917, although the data associated with it has been growing consistently. Post-game shootout goals are included in the collection but they are specifically marked as such. It costs $0.01/item to retrieve, and the is updated daily.

HIT
Entry as returned by the list command:
      {
         "updated" : 1,
         "count" : 748681,
         "type" : "events",
         "description" : "Hit events",
         "since" : 2005,
         "cost" : 0.01,
         "name" : "HIT"
      },

The collection contains Hit events. They are available since 2005. It costs $0.01/item to retrieve and there are the same number of such events as the games, updated daily, and the number of items is surpassing 750K.

MISS
Entry as returned by the list command:
      {
         "name" : "MISS",
         "since" : 2005,
         "cost" : 0.01,
         "description" : "Missed shot events",
         "type" : "events",
         "count" : 399962,
         "updated" : 1
      },

The collection contains Miss (missed shots) events. They are available since 2005. A missed shot is a puck that is determined to have been shot towards a goal and did not encounter any obstacle until it crossed the goal line outside the goal, or until it hit the goal frame. Post-game shootout misses are included in the collection but they are specifically marked as such. It costs $0.01/item to retrieve and it is updated daily.

PEND
Entry as returned by the list command:
      {
         "since" : 1917,
         "cost" : 0.01,
         "name" : "PEND",
         "updated" : 1,
         "count" : 191395,
         "type" : "events",
         "description" : "Period End events"
      },

The collection contains Period End events. Although they began only to appear since 2007 in the Play By Play HTML, we generate such one for every game since 1917 and append it to the game event list at the end of each period's events. It costs $0.01/item to retrieve and it is updated daily. Shootout periods have their PEND events as well.

PENL
Entry as returned by the list command:
      {
         "name" : "PENL",
         "since" : 1917,
         "cost" : 0.01,
         "type" : "events",
         "description" : "Penalty events",
         "updated" : 1,
         "count" : 697374
      },

The collection contains Penalty events. They are available since the start of the league in 1917, although the data associated with it has been growing consistently. It costs $0.01/item to retrieve and there are the same number of such events as the games, updated daily. We include all penalty events reported in the live feed and PBP reports, including penalty-shot penalties, coach and bench penalties.

PSTR
Entry as returned by the list command:
      {
         "name" : "PSTR",
         "cost" : 0.01,
         "since" : 1917,
         "description" : "Period Start events",
         "type" : "events",
         "count" : 191395,
         "updated" : 1
      },

The collection contains Period Start events. Although they began only to appear since 2007 in the Play By Play HTML, we generate such one for every game since 1917 and prepend it to the game event list at the start of each period's events. It costs $0.01/item to retrieve and it is updated daily. Shootout periods have their PSTR events as well. The number of the events in the PSTR and PEND collections is identical.

SHOT
Entry as returned by the list command:
      {
         "cost" : 0.01,
         "since" : 2002,
         "name" : "SHOT",
         "count" : 1060954,
         "updated" : 1,
         "description" : "Shot on Goal events",
         "type" : "events"
      },

The collection contains SHOT (shot on goal) events. They are available since 2002. A shot on goal is a puck that is determined to have been shot or deflected towards a goal and did not encounter any obstacle until it was stopped by a goaltender. Shots that resulted in a Goal are in a separate collection. Post-game shootout shots on goal are included in the collection but they are specifically marked as such. It costs $0.01/item to retrieve and there are the same number of such events as the games, updated daily. This is one of the largest collection in the database, featuring over 1 million of items.

STOP
Entry as returned by the list command:
      {
         "name" : "STOP",
         "since" : 2002,
         "cost" : 0.01,
         "type" : "events",
         "description" : "Stoppage events",
         "updated" : 1,
         "count" : 873958
      },

The collection contains STOP (stoppage) events. They are available since 2002. Period End is not considered a stoppage event. Stoppage events except for the joint stoppage/penalty-shot penalty events are followed by faceoffs. We do not separate stoppages by their types. It costs $0.01/item to retrieve and there are the same number of such events as the games, updated daily.

TAKE
Entry as returned by the list command:
      {
         "type" : "events",
         "description" : "Takeaway events",
         "updated" : 1,
         "count" : 234158,
         "name" : "TAKE",
         "since" : 2002,
         "cost" : 0.01
      },

The collection contains Takeaway events. They are available since 2005. The Takeaway statistic is not considered to be recorded reliably and consistently. It costs $0.01/item to retrieve and it is, updated daily.

challenges
Entry as returned by the list command:
      {
         "cost" : 0,
         "since" : 2015,
         "name" : "challenges",
         "count" : 1215,
         "updated" : 1,
         "description" : "Specially reworked generated challenge events",
         "type" : "events"
      },

The collection contains specially generated Challenge events deducted from both CHL and STOP events. They also include NHL challenge events. They are provided for free, and there are over 1200 such events since 2015 when challenges were introduced. It is updated daily.

coaches
Entry as returned by the list command:
      {
         "since" : 1987,
         "cost" : 0,
         "name" : "coaches",
         "updated" : 1,
         "count" : 256,
         "type" : "people",
         "description" : "NHL coaches"
      },

The collection contains all the coaches who have been known to coach an NHL team. The data has been recorded in the live feeds since 1987, and so the collection contains the data since that season. The collection is also a catalog: all the names are mapped to the MongoDB BSON OIDs which are then in turn used elsewhere in the database. The collection is free and contains over 250 entries.

common_games
Entry as returned by the list command:
      {
         "count" : 7698,
         "updated" : 1,
         "description" : "Common games between two players",
         "type" : "people",
         "since" : 1917,
         "cost" : 0.1,
         "name" : "common_games"
      },

The collection contains a specially generated list of game ids in which two given players participated together on the same team. This is a highly special collection because the primary id key in it are the NHL player IDs, and the keys in it are the players they have common games with. To avoid duplication only the players with numerically lesser IDs are used as keys within each item. The collection costs $0.10 per item and is updated daily.

conferences
Entry as returned by the list command:
      {
         "since" : 1917,
         "cost" : 0,
         "name" : "conferences",
         "count" : 52,
         "updated" : 4,
         "description" : "NHL conferences through the years",
         "type" : "league"
      },

The collection contains all the complexions of the conferences in the NHL history. A somewhat obscure collection, it features the divisions that belong to that conference. The collection is free and updated on a yearly basis (when necessary). Please see more about this and the divisions collections in the seasons collection description.

divisions
Entry as returned by the list command:
      {
         "name" : "divisions",
         "since" : 1917,
         "cost" : 0,
         "type" : "league",
         "description" : "NHL divisions through the years",
         "updated" : 4,
         "count" : 105
      },

The collection contains all the complexions of the divisions in the NHL history. A somewhat obscure collection, it features the teams that belong to that division. The collection is free and updated on a yearly basis (when necessary). Please see more about this and the conferences collections in the seasons collection description.

games
Entry as returned by the list command:
      {
         "count" : 60141,
         "updated" : 1,
         "description" : "All the NHL and Stanley Cup Playoffs games",
         "type" : "games",
         "cost" : 0.2,
         "since" : 1917,
         "name" : "games"
      },

The collection contains the games played in the NHL and in the Stanley Cup Playoffs including the games against the PCHA teams. Preseason games are not included. This is the core collection of the database, and it contains extensive data merged from the following sources available on the NHL website:

  • JSON live feeds
  • Roster, Play-By-Play, Game Summary and Event Summary HTML reports
The resulting game boxscores are then run through thousands of tests to validate their data. The collection costs $0.20/item and is updated daily.

locations
Entry as returned by the list command:
      {
         "since" : 1997,
         "cost" : 0,
         "name" : "locations",
         "count" : 153,
         "updated" : 3,
         "description" : "NHL venues",
         "type" : "league"
      },

The collection contains all the venues used for the NHL games since this data started being recorded in the NHL reports around the 1997/98 season. The collection also has the maximum attendance data for each venue. Special venues such as football stadiums for the outdoor games or European areans are not explicitly marked, but they may become. The collection contains over 150 different venues and is free.

misses
Entry as returned by the list command:
      {
         "since" : 2005,
         "cost" : 0,
         "name" : "misses",
         "count" : 5,
         "updated" : 5,
         "description" : "Types of missed shots",
         "type" : "catalog"
      },

The collection contains the list of all types of misses being recorded in the NHL games and the default fallback UNKNOWN miss. The collection is a catalogue: all the string values are mapped to the MongoDB BSON OIDs which are then in turn used elsewhere in the database. The collection is free and it is updated manually and very rarely.

penalties
Entry as returned by the list command:
      {
         "name" : "penalties",
         "since" : 1917,
         "cost" : 0,
         "type" : "catalog",
         "description" : "Types of penalties",
         "updated" : 5,
         "count" : 77
      },

The collection contains the list of all types of penalties being recorded in the NHL games and the default fallback UNKNOWN penalty. The collection is a catalogue: all the string values are mapped to the MongoDB BSON OIDs which are then in turn used elsewhere in the database. The collection does not contain penalty length and/or severities. The collection is free and it is updated manually and very rarely.

players
Entry as returned by the list command:
      {
         "type" : "people",
         "description" : "NHL players and drafted prospects",
         "updated" : 1,
         "count" : 19804,
         "name" : "players",
         "cost" : 0.1,
         "since" : 1917
      },

The collection contains the list of all players who ever featured on the NHL rosters and were assigned an NHL id. In addition we also feature goalie Charlie Reid that appeared in two games of the 1924 Stanley Cup Finals but for some reason did not get an NHL id. Just like with the game data, each player item is tested for validity and sanity. Players that have only appeared as scratches and thus weren't assigned an NHL id are not included. The collection costs $0.10 per item and is updated daily.

schedule
Entry as returned by the list command:
      {
         "updated" : 4,
         "count" : 61107,
         "type" : "games",
         "description" : "Season schedules of the NHL",
         "since" : 1917,
         "cost" : 0,
         "name" : "schedule"
      },

The collection contains the schedule of all of the NHL games as they were scheduled season by season. This collection is parallel to the games collection but only contains the pre-game data. The collection is free and it is updated when games are rescheduled, at the start of the season, once a new season schedule is published, and during the playoffs, when the series' schedules are published.

seasons
Entry as returned by the list command:
      {
         "type" : "league",
         "description" : "NHL seasonal structure through the years",
         "updated" : 4,
         "count" : 102,
         "name" : "seasons",
         "since" : 1917,
         "cost" : 0
      },

The collection contains the conference-division-team structure of each and every NHL season. The collection contains the OIDs of conferences for each season (or NHL if no conferences were defined), the conferences contain divisions (or NHL if no divisions were defined), and the divisions contain the franchise IDs as teams.

shot_types
Entry as returned by the list command:
      {
         "name" : "shot_types",
         "cost" : 0,
         "since" : 2002,
         "description" : "Types of shots",
         "type" : "catalog",
         "count" : 8,
         "updated" : 5
      },

The collection contains the list of all types of shots being recorded in the NHL games and the default fallback UNKNOWN miss. The collection is a catalogue: all the string values are mapped to the MongoDB BSON OIDs which are then in turn used elsewhere in the database. The collection is free and it is updated manually and very rarely.

stopreasons
Entry as returned by the list command:
      {
         "count" : 32,
         "updated" : 5,
         "description" : "Reasons for stoppage",
         "type" : "catalog",
         "since" : 2002,
         "cost" : 0,
         "name" : "stopreasons"
      },

The collection contains the list of all types of stoppage reasons being recorded in the NHL games and the default fallback UNKNOWN stop reason. The collection is a catalogue: all the string values are mapped to the MongoDB BSON OIDs which are then in turn used elsewhere in the database. The collection is free and it is updated manually and very rarely.

strengths
Entry as returned by the list command:
      {
         "updated" : 5,
         "count" : 4,
         "type" : "catalog",
         "description" : "Strength situation of NHL events",
         "cost" : 0,
         "since" : 1998,
         "name" : "strengths"
      },

The collection contains the list of all types of team strengths (EV, SH, PP) being recorded in the NHL games and the default fallback XX stop reason. The collection is a catalogue: all the string values are mapped to the MongoDB BSON OIDs which are then in turn used elsewhere in the database. Penalty shot and Empty Net are not considered separate strength situations. The collection is free and it is updated manually. The strength property of the event is superceded by the icecount field for the events since season 2007/08.

teams
Entry as returned by the list command:
      {
         "description" : "NHL teams",
         "type" : "league",
         "count" : 43,
         "updated" : 4,
         "name" : "teams",
         "cost" : 0,
         "since" : 1917
      },

The collection contains the franchises that played in the NHL since the 1917/18 seasons. The different incarnations of the franchises are available as sub-fields of the collection items. Both defunct and existing franchises are available, with the exception of the PCHA franchises who competed in the Stanley Cup Playoffs. The collection is free and is expected to be updated once Seattle joins the league.

zones
Entry as returned by the list command:
      {
         "cost" : 0,
         "since" : 2002,
         "name" : "zones",
         "count" : 4,
         "updated" : 5,
         "description" : "Types of zones",
         "type" : "catalog"
      }

The collection contains the list of all zones (NEU, DEF, OFF) being recorded in the NHL games and the default fallback UNK stop reason. The collection is a catalogue: all the string values are mapped to the MongoDB BSON OIDs which are then in turn used elsewhere in the database. The coordinates property of events is supposed to supercede this setting, unfortunately, the coordinate system of reference varies by home/away between games. The collection is free and it is not updated.

Collection Filters

The section below describes the collection search filters. The fields in these filters may be used later in the fields and sort modifiers, but only with 1/-1 values. We will begin with the description of all available fields, because some of them are applicable to more than one collection in exactly the same way. When the same field is used differently between two collections, we will provide two different descriptions. Then we will follow with the reference of fields by collection as well as examples of filters.

You cannot query more than one collection at once. That's the original limitation of Mongo, and while there are certain workarounds for this in direct operation against latest MongoDB servers, we are not going to implement that capacity. You can, however, provide some extra flexibility by using nested $and or $or logical operators followed by an array of filters. Not all fields may be present in every item within the same collection. You can filter for their existense by specifyin the value as a mapping: { "$exists": 1 }.

API Query Fields Reference (in alphabetic order)

Field: _id
Type: BSON OID | INTEGER | STRING (varies by collection)
Appears in: every Mongo collection.
Description: this is the basic primary key of each and every collection. By default it is of BSON ObjectId format. For the sake of the queries of the API, it is sufficient just to pass the 12-byte hex string, e.g. "5bf37a9b9ad6903d578fac49". In some collections this field is represented differently:
  • In teams: a three-letter franchise code.
  • In any event-type collection: a 13-digit number, where first nine digits are the game ID, and the last four the event id.
  • In games: a 9-digit number, where first four digits represent the season, the fifth - stage (2 for Regular, 3 for Playoff), and last four - the seasonal game id.
  • In schedule: a 10-digit NHL's game id.
  • In players and common_games: a 7-digit NHL's player id, usually starting with 84.
Field: active
Type: 0|1
Appears in: players.
Description: This is the marking of a player whether he's considered active or not. Most frequently this will carry the value of the active flag of the NHL database, but sometimes, like in case of Marian Hossa, it may be amended manually.

Field: assist1
Type: 7-digit NHL player ID
Appears in: GOAL.
Description: Primary assister on a goal. Does not exist on unassisted goals.

Field: assist2
Type: 7-digit NHL player ID
Appears in: GOAL.
Description: Secondary assister on a goal. Does not exist on unassisted and single-assisted goals.

Field: assists[]
Type: ARRAY of two 7-digit NHL player IDs
Appears in: GOAL.
Description: Primary and secondary assister on a goal. Shrinks according to the number of the assists.

Field: attendance
Type: INTEGER
Appears in: games.
Description: Attendance of the game, as reported by the HTML reports.

Field: away
Type: 3-char Franchise Code
Appears in: schedule.
Description: The team playing away in a scheduled game.

Field: birthdate
Type: UNIX TIMESTAMP
Appears in: players.
Description: Player's birthdate as a Unix Timestamp (number of seconds since 01/01/1970). Players born before that date have a negative timestamp.

Field: capacity
Type: INTEGER
Appears in: locations.
Description: Maximum attendance ever recorded at the arena.

Field: challenge
Type: ENUM STRING
Appears in: CHL.
Description: Coach/NHL's challenge type (OFFSIDE or INTERFERENCE ON GOALIE).

Field: city
Type: STRING
Appears in: players.
Description: The city of birth of the NHL player.

Field: clutch{}(*)
Type: MAPPING
Appears in: GOAL.
Description: If the goal is a clutch, then the field is set to a mapping:
{ "type": "gwg"|"lgwg"|"gtg"|"lgtg"|"geg", "player": 7-digit ID }
If the goal is not the field does not exist. Please note that our definition of a gwg differs from the one of the NHL.
(*) This field is generated by MoreHockeyStats.

Field: coach
Type: BSON OID
Appears in: challenges.
Description: The ID of the coach issuing the challenge.

Field: coach_name
Type: STRING
Appears in: challenges.
Description: The name of the coach issuing the challenge.

Field: conferences[]
Type: ARRAY of BSON OIDs
Appears in: seasons.
Description: The _ids of the conferences corresponding to this season.

Field: coordinates{}
Type: MAPPING
Appears in: BLOCK | FAC | GIVE | GOAL | HIT | MISS | PENL | SHOT | TAKE.
Description: Mapping {"x": INTEGER, "y": INTEGER} containing the point of the event. The frame of reference is inverted sometimes with regards to the ordinate axis.

Field: country
Type: 3-digit country code
Appears in: players.
Description: Player's country of birth.

Field: date
Type: Formatted INTEGER
Appears in: games | schedule.
Description: The date of the game in the YYYYMMDD format.

Field: defunct
Type: 0|1
Appears in: teams.
Description: Flag if the franchise is defunct or not. Includes PCHA franchises.

Field: distance
Type: INTEGER
Appears in: BLOCK | GOAL | MISS | SHOT.
Description: The distance between the spot of the shot to the center of the goal the puck was shot at.

Field: divisions[]
Type: ARRAY of BSON OIDs
Appears in: conferences.
Description: The _ids of the divisions corresponding to this season.

Field: draftteam
Type: 3-digit Franchise ID
Appears in: players.
Description: The franchise that drafted the player. Doesn't exist for undrafted players.

Field: draftyear
Type: INTEGER
Appears in: players.
Description: The year the player was drafted. Doesn't exist for undrafted players.

Field: en
Type: 0|1
Appears in: GOAL.
Description: Flag whether the goal was scored into an empty net. May be absent at all.

Field: end
Type: UNIX Timestamp
Appears in: coaches.
Description: The end timestamp of the latest tenure of a coach, plus/minus a day.

Field: ensuing_event(*)
Type: MAPPING
Appears in: STOP.
Description: event that supposedly ensued after an icing, within the next thirty seconds after it, mapping:
{"type": "STOP"|"PEND"|"PENL"|"GOAL", "id": EVENT_ID }
It is possible that no event ensued.

(*) This field is generated by MoreHockeyStats

Field: faceoff(*)
Type: EVENT_ID
Appears in: STOP.
Description: The id of the faceoff that followed the icing.

(*) This field is generated by MoreHockeyStats

Field: faceoff_win
Type: 0|1
Appears in: STOP.
Description: The winning team of the faceoff following the icing (0 - away, 1 - home)

(*) This field is generated by MoreHockeyStats

Field: folded
Type: INTEGER
Appears in: teams.
Description: The year in which NHL franchise folded. Doesn't exist for the current ones.

Field: founded
Type: INTEGER
Appears in: teams.
Description: The year in which NHL franchise was founded. Doesn't exist for the PCHA franchises.

Field: full[]
Type: ARRAY of STRING
Appears in: teams.
Description: Full names used by the franchise.

Field: game_id
Type: GAME_ID
Appears in: BLOCK | CHL | FAC | GEND | GIVE | GOAL | HIT | MISS | PEND | PENL | PSTR | SHOT | STOP | TAKE | challenges | schedule.
Description: MoreHockeyStats 9-digit Game ID for reference in events, schedule and other collections.

Field: games[]
Type: ARRAY of GAME_ID
Appears in: coaches.
Description: List of games, referenced by game_id, coached by the coach.

Field: games[]
Type: ARRAY of GAME_ID
Appears in: players.
Description: List of games, referenced by game_id, in which the player participated. Games as scratches, or games with 0 TOI are not counted.

Field: gwg
Type: 0|1
Appears in: GOAL.
Description: NHL's own setting for a goal being the gwg. May not exist.

Field: height
Type: INTEGER
Appears in: players.
Description: Player's height, in inches.

Field: home
Type: 3-char Franchise Code
Appears in: schedule.
Description: The team playing home in a scheduled game.

Field: icecount(*)
Type: Formatted INTEGER
Appears in: BLOCK | CHL | FAC | GIVE | GOAL | HIT | MISS | PENL | SHOT | STOP | TAKE.
Description: The count of the players on the ice during the event, NNNN
  • 1st digit is for count of away skaters
  • 2nd digit is for count of away goalies
  • 3rd digit is for count of home skaters
  • 4th digit is for count of home goalies
(*) This field is generated by MoreHockeyStats.

Field: injury_status(*)
Type: ENUM STRING
Appears in: players.
Description: The injury status of a player: one of "OK"|"DTD"|"OUT"|"IR".
(*) This field is generated by MoreHockeyStats.

Field: lcg(*)
Type: 0|1
Appears in: GOAL.
Description: Is the goal a lead-changing goal (tying or go-ahead)?
(*) This field is generated by MoreHockeyStats.

Field: length
Type: ENUM INTEGER
Appears in: PENL.
Description: Length of penalty, one of 0|2|3|4|5|10.

Field: location
Type: BSON OID
Appears in: games.
Description: The _id of the location (venue) of the game.

Field: long[]
Type: ARRAY of STRINGS
Appears in: teams.
Description: Name variants of teams, all kinds, except abbreviations.

Field: loser
Type: 3-digit Franchise Code
Appears in: challenges.
Description: The team on the losing end of the challenge's outcome.

Field: lsg(*)
Type: 0|1
Appears in: GOAL.
Description: Is the goal a lead-swinging goal (second lead-changing goal in a row by a team)? Any lsg is a lcg.
(*) This field is generated by MoreHockeyStats.

Description: The team on the losing end of the challenge's outcome.

Field: miss(*)
Type: BSON OID
Appears in: MISS.
Description: The type of the miss as recorded by the NHL, converted to OID.

Field: month(*)
Type: INTEGER
Appears in: games.
Description: Month of the game 1-12. Usually there are no games in months 8 and 9.
(*) This field is generated by MoreHockeyStats.

Field: name
Type: STRING
Appears in: coaches | conferences | divisions | locations | misses | penalties | players | shot_types | stopreasons | strengths | zones.
Description: The name string of a catalog object, of a coach or a player, of a location, division or conference.

Field: ne(*)
Type: 0|1
Appears in: GOAL.
Description: Flag whether the goal was scored while playing with an empty net.
(*) This field is generated by MoreHockeyStats.

Field: number
Type: INTEGER
Appears in: players.
Description: The number on player's jersey currently.

Field: offset(*)
Type: MAPPING
Appears in: PENL.
Description: Indicates the penalty offsetting this one, if exists. The mapping has the format:
{"_id": EVENT_ID, "player": PLAYER_ID, "type": INTEGER}
Type is 1 for fighting, 2 for offsetting minors, difference between penalties otherwise. Negative value means the offsetting penalty was longer.
(*) This field is generated by MoreHockeyStats.

Field: on_ice[][]
Type: ARRAY of ARRAYS of 7-digit player ids
Appears in: BLOCK | CHL | FAC | GIVE | GOAL | HIT | MISS | PENL | SHOT | STOP | TAKE.
Description: The players present on ice at the time of the event. First sub-array has the players for the away team. Second sub-arrray has the players for the home team.

Field: ot
Type: 0|1
Appears in: games.
Description: Flag for games that were decided in the OT or SO. May not be present in all games.

Field: penalty
Type: BSON OID
Appears in: PENL.
Description: The type of the penalty as recorded by the NHL, converted to OID.

Field: penaltyshot
Type: 0|1
Appears in: BLOCK | GOAL | MISS | SHOT.
Description:

Field: period
Type: INTEGER
Appears in: BLOCK | CHL | FAC | GEND | GIVE | GOAL | HIT | MISS | PEND | PENL | PSTR | SHOT | STOP | TAKE.
Description: The period in which the event happened. SO event are in period 5.

Field: pick
Type: INTEGER
Appears in: players.
Description: The draft pick overall of the player. Undrafted players are marked as picked at #300.

Field: player1
Type: 7-digit player id
Appears in: BLOCK | FAC | GIVE | GOAL | HIT | MISS | PENL | SHOT | TAKE.
Description: The player who produced the event. In the BLOCK event it's the player who blocked the shot. Special ID is assigned for bench/coach penalties.

Field: player2
Type: 7-digit player id
Appears in: BLOCK | FAC | GOAL | HIT | PENL | SHOT.
Description: The player on the receiving end of the event. In the BLOCK event it's the shooter. In the GOAL event it's the goaltender. In the

Field: position
Type: ENUM STRING
Appears in: players.
Description: Playing position of a player G | D | C | L | R.

Field: result[]
Type: ARRAY of INTEGER or "GOAL"|"GOAL OVERTURNED"
Appears in: games | CHL | challenges.
Description: in games: the number of points the teams received as the result of the game. First number is for the away team, second is for the home team. In CHL and challenges: whether the challenge was successful.

Field: rookie
Type: 0|1
Appears in: players.
Description: Whether the NHL defines the player as a rookie.

Field: round
Type: INTEGER
Appears in: players.
Description: The round in which the player was picked in the draft. Undefined for undrafted.

Field: season
Type: INTEGER
Appears in: BLOCK | CHL | FAC | GEND | GIVE | GOAL | HIT | MISS | PEND | PENL | PSTR | SHOT | STOP | TAKE | games | schedule.
Description: Four-digit year of the start of the season. Lockout-affected seasons, such as 1994/95 and 2012/13 are still marked as 1994 and 2012.

Field: servedby
Type: 7-digit player id
Appears in: PENL.
Description: Player serving the penalty. Not present when the penalized player is serving.

Field: severity
Type: STRING
Appears in: PENL.
Description: The severity of the penalty.

Field: shoots
Type: L|R
Appears in: players.
Description: The handedness of the player or the goalie.

Field: short[]
Type: ARRAY of team codes
Appears in: teams.
Description: Various 2-4 symbol codes used as a team abbreviation.

Field: shot_type
Type: BSON OID
Appears in: BLOCK | GOAL | MISS | SHOT.
Description: The type of the shot as recorded by the NHL, converted to OID.

Field: so
Type: 0|1
Appears in: games.
Description: Flag if the game was decided in a shootout. Implies ot. May not be present if the game ended before shootout.

Field: stage
Type: 2|3
Appears in: BLOCK | CHL | FAC | GEND | GIVE | GOAL | HIT | MISS | PEND | PENL | PSTR | SHOT | STOP | TAKE | games | schedule.
Description: The stage of the season in which the item happened: 2 for Regular, 3 for Playoffs.

Field: start
Type: UNIX TIMESTAMP
Appears in: coaches.
Description: The Unix timestamp of the coach current or latest tenure.

Field: start_ts
Type: UNIX TIMESTAMP
Appears in: games.
Description: The Unix timestamp of the game starting time.

Field: starts[]
Type: ARRAY of game ids.
Appears in: players.
Description: Games in which the player was in the starting six.

Field: state
Type: STRING
Appears in: players.
Description: The birth state or province of the player. "NA" for non-North-American player (Not Applicable).

Field: stop_ts
Type: UNIX TIMESTAMP
Appears in: games.
Description: The Unix timestamp of the game ending time.

Field: strength
Type: BSON OID
Appears in: BLOCK | CHL | FAC | GEND | GIVE | GOAL | HIT | MISS | PEND | PENL | PSTR | SHOT | STOP | TAKE.
Description: The type of the strength of the teams at the event as recorded by the NHL, converted to OID.

Field: t
Type: 0|1
Appears in: BLOCK | BLOCK | CHL | CHL | FAC | FAC | GIVE | GIVE | GOAL | GOAL | HIT | HIT | MISS | MISS | PENL | PENL | SHOT | SHOT | STOP | STOP | TAKE | TAKE.
Description: The home/away team causing the event: 0 for away, 1 for home.

Field: team
Type: 3-digit franchise code
Appears in: coaches | players.
Description: The current team of player or coach

Field: team1
Type: 3-letter franchise code
Appears in: BLOCK | CHL | FAC | GIVE | GOAL | HIT | MISS | PENL | SHOT | STOP | TAKE.
Description: The team causing the event. In STOP events only icings and offsides are covered.

Field: team2
Type: 3-letter franchise code
Appears in: BLOCK | CHL | FAC | GIVE | GOAL | HIT | MISS | PENL | SHOT | STOP | TAKE.
Description: The team on the receiving end of the event.

Field: teams[]
Type: ARRAY of (see description)
Appears in: games | players | coaches | divisions.
Description: The teams involved:
  • divisions: ARRAY of 3-letter franchise codes making the division.
  • games: ARRAY of 2 members, for away and home teams, each one a MAPPING:
    • coach: BSON OID of the coach
    • pull: provided by NHL, always 0
    • name: 3-digit franchise code
    • scratches: ARRAY of 7-digit player ids
    • decision: L|W|O|N, goalie decision
    • score: INTEGER, goals scored
    • shots: INTEGER, shots taken
    • stats: MAPPING of NHL provided team stats
    • roster: ARRAY of MAPPINGS of player statistics. See example for more details. Note: all the skater statistics are in uppercase letters. All goaltender statistics and non-statistical fields are in lowercase letters.
  • coaches | players ARRAY of MAPPINGs of the team history of the coach or the player:
    { "start": UNIX_TIMESTAMP, "end": UNIX_TIMESTAMP, "team": "3-letter franchise code" }


Field: ts
Type: INTEGER or UNIX TIMESTAMP
Appears in: BLOCK | CHL | FAC | GEND | GIVE | GOAL | HIT | MISS | PEND | PENL | PSTR | SHOT | STOP | TAKE | challenges | schedule.
Description: The number of seconds of game time since the start of the game until the event. For schedules, it's the Unix Timestamp for the scheduled start.

Field: type
Type: o|i
Appears in: challenges.
Description: Abbreviated type of the challenge (offside or interference)

Field: undrafted
Type: 0|1
Appears in: players.
Description: Flag whether the player is undrafted.

Field: weight
Type: INTEGER
Appears in: players.
Description: Player's weight in pounds

Field: winner
Type: 3-digit franchise code
Appears in: challenges.
Description: The winning team of the challenge.

Field: winning_team
Type: 3-digit franchise code
Appears in: FAC.
Description: The winning team of the faceoff.

Field: year
Type: INTEGER
Appears in: schedule | seasons.
Description: The season year of the scheduled game or of a season.

Field: zone
Type: BSON OID
Appears in: BLOCK | CHL | FAC | GIVE | GOAL | HIT | MISS | PENL | SHOT | STOP | TAKE.
Description: The zone of the event as recorded by the NHL, converted to OID.

API Query Fields by Collection

Collection: BLOCK
Fields: _id, game_id, period, season, stage, strength, ts, t, icecount, team1, team2, t, zone, on_ice[][], player1, coordinates.x, coordinates.y, penaltyshot, shot_type, distance, player2
Filter Example:
{
	"season": 2017,
	"icecount": 5151,
	"shot_type": "5b6e4b5c9ad690577c0b3dac",
	"coordinates.x": {"$gte" : 50}
}
Filter Explanation:

This filter searches the blocked shots in the 2017 season, at 5v5, whose X coordinate is more or equal than 50, of shots of type OID "5b6e4b5c9ad690577c0b3dac" which maps (q.v.) to "WRIST"

Collection: CHL
Fields: _id, game_id, period, season, stage, strength, ts, t, icecount, team1, team2, t, zone, on_ice[][], challenge, result
Filter Example:
{
	"season": 2017,
	"period": 1,
	"game_id" : {"$lte": 201720100 }
}
Filter Explanation:

This filter searches the challenges issued in the first 100 games of the 2017 season (via game ids) in the first period.

Collection: FAC
Fields: _id, game_id, period, season, stage, strength, ts, t, icecount, team1, team2, t, zone, on_ice[][], player1, coordinates.x, coordinates.y, player2, winning_team
Filter Example:
{
	"player1": 8475172,
	"player2": 8476460,
	"zone": "5b6e4b5c9ad690577c0b3d96"
}
Filter Explanation:

This filter searches for all faceoffs Nazem Kadri (player ID 8475172) won against Mark Scheifele (player ID 8476460) in the Neutral zone defined by the OID.

Collection: GEND
Fields: _id, game_id, period, season, stage, strength, ts, timestamp
Filter Example:
{
	"season": 2017,
	"stage": 3,
	"ts" : {"$gt": 3600 }
}
Filter Explanation:

This query searches for all GEND events that happened after more than 3600 seconds of game time in the 2017/18 Playoffs.

Collection: GIVE
Fields: _id, game_id, period, season, stage, strength, ts, t, icecount, team1, team2, t, zone, on_ice[][], player1, coordinates.x, coordinates.y
Filter Example:
{
	"$or": [ 
		{
			"t": 0, 
			"on_ice.0": {
				"$elemMatch": {
					"$in": [8475172]
				}
			}
		},
		{
			"t": 1,
			"on_ice.1": {
				"$elemMatch": {
					"$in": [8475172]
				}
			}
		}
	]
}
Filter Explanation:

This filter searches for Giveaways when Nazem Kadri (player ID 8475172) was on the ice as the team committing the Giveaway. You can see the search through the on_ice field using the $elemMatch MongoDB operator.

Collection: GOAL
Fields: _id, game_id, period, season, stage, strength, ts, t, icecount, team1, team2, t, zone, on_ice[][], player1, coordinates.x, coordinates.y, penaltyshot, shot_type, distance, player2, assist1, assist2, assists, en, ne, gwg, lcg, lsg, clutch
Filter Example:
{
	"assist2": { "$exists": 1 },
	"ne" : 1,
	"team2" : "SJS",
	"season" : { "$in": [2016, 2017] }
}
Filter Explanation:

This filter searches the Goals the San Jose Sharks allowed in seasons 2016 and 2017 that their opponent scored with an extra attacker, and that had a secondary assist as well.

Collection: HIT
Fields: _id, game_id, period, season, stage, strength, ts, t, icecount, team1, team2, t, zone, on_ice[][], player1, coordinates.x, coordinates.y, player2
Filter Example:
{
	"$or" : [ 
		{
			"player1" : 8471214,
			"player2" : 8471686
		}, {
			"player2" : 8471214,
			"player1" : 8471686
		}
	]
}
Filter Explanation:

This filter searches the Hits for the hits Alex Ovechkin (id 8471214) and Marc Staal (id 8471686) have laid upon each other.

Collection: MISS
Fields: _id, game_id, period, season, stage, strength, ts, t, icecount, team1, team2, t, zone, on_ice[][], player1, coordinates.x, coordinates.y, penaltyshot, shot_type, distance
Filter Example:
{
	"miss" : {
		"$in" : [
			"5b6f69d09ad6907cd25ebf6d",
			"5b6f69e39ad6907cd25ec257"
		]
	},
	"player1" : 8475765,
	"stage" : 3
}
Filter Explanation:

This filter searches for the times Vladimir Tarasenko (player ID 8475765) hit the post or the crossbar (misses converted to OIDs) in the playoffs.

Collection: PEND
Fields: _id, game_id, period, season, stage, strength, ts, timestamp
Filter Example:

See GEND example.

Filter Explanation:
Collection: PENL
Fields: _id, game_id, period, season, stage, strength, ts, t, icecount, team1, team2, t, zone, on_ice[][], player1, coordinates.x, coordinates.y, player2, servedby, penalty, length, severity, offset
Filter Example:
{
	"servedby": 8470621,
	"player1": 8000001
}
Filter Explanation:

This filter searches all the BENCH penalties (special player ID 8000001) served by Corey Perry (player id 8470621.

Collection: PSTR
Fields: _id, game_id, period, season, stage, strength, ts, timestamp
Filter Example:

See GEND example.

Filter Explanation:
Collection: SHOT
Fields: _id, game_id, period, season, stage, strength, ts, t, icecount, team1, team2, t, zone, on_ice[][], player1, coordinates.x, coordinates.y, penaltyshot, shot_type, distance, player2
Filter Example:
{
	"player2" : { 
		"$in" : [
			8474651,
			8468685
		]
	},
	"player1" : 8471675,
	"distance" : { "$lte" : 30 },
	"icecount" : 4141
}
Filter Explanation:

This filter searches for Shots by Sidney Crosby (player ID 8471675) while 4 on 4 (icecount 4141) saved by either Henrik Lundqvist (player ID 8468685) or Braden Holtby (player ID 8474651) from the distance of thirty feet or less from the goal.

Collection: STOP
Fields: _id, game_id, period, season, stage, strength, ts, t, icecount, team1, team2, t, zone, on_ice[][], faceoff_win*, faceoff*, ensuing_event*
Filter Example:
{
	"season" : 2017,
	"game_id" : {"$lte": 201720100 },
	"stopreasons" : "5b6f675a9ad6907cd25d3e45",
       	"period" : 1	
}
Filter Explanation:

This filter searches the Stoppages when the puck went into benches ("PUCK IN BENCHES" as OID) in the first periods of the first hundred games of the 2017/18 season.

Collection: TAKE
Fields: _id, game_id, period, season, stage, strength, ts, t, icecount, team1, team2, t, zone, on_ice[][], player1, coordinates.x, coordinates.y
Filter Example:

See GIVE example.

Collection: challenges
Fields: _id, coach, coach_name, game_id, loser, result, ts, type, winner
Filter Example:
{
	"loser": "MTL",
	"type": "i"
}
Filter Explanation:

This filter searches for all goalie interference challenges where Montreal Canadiens were on the losing end, i.e. either challenged and lost, or had the other team challenge and won.

Collection: coaches
Fields: _id, end, games, name, start, team, teams
Filter Example:
Besides the example provided at the beginning of this manual, here's the most popular one:
{
	"name" : { "$regex": /guy boucher/i }
}
Filter Explanation:

This provides all the coach data collected about GUY BOUCHER, including his OID used elsewhere, e.g. in games and challenges. Please note that all string values are in uppercase letters, putting them in a regex would catch lowercase, but put some extra load on the database :) .

Collection: common_games
Fields: _id, $player_id
Filter Example:
"filter" : {
	"_id": 8471675,
},
"fields" : {
	"8471215" : 1,
}
Filter Explanation:

The best way to use the common_games collection is to combine it with the fields qualifier. The above filter returns the game where Sidney Crosby (player id 8471675) and Evgeny Malkin (player id 8471215) participated together. Always query by the smaller id, and always qualify by the larger one. Please note to quote the second id, since it is a field name.

Collection: conferences
Fields: _id, divisions, name
Filter Example:
{
	"name": "Eastern"
}
Filter Explanation:

This filter searches for all incarnations of "Eastern" conference in the NHL history.

Collection: divisions
Fields: _id, name, teams
Filter Example:
{
	"teams": "DAL"
}
Filter Explanation:

This filter searches for all incarnations of the divisions that had the Dallas Stars franchise in it. It will also return the divisions the Minnesota North Stars were part of.

Collection: games
Fields: attendance, date, location, month, ot, result[], season, so, start_ts, stop_ts, teams
Filter Example:
Note: this is the richest collection of the database, and the queries on it may be of various complexity.
{
	"teams.name" : "CHI",
	"teams.score" : { "$gte": 6 },
	"season" : {
		"$in" : [
			2012, 2013, 2014, 2015
		]
	},
	"ot" : 0
}
Filter Explanation:

This filter searches for games where one of the team was Chicago Blackhawks, and at least one team scored at least six goals in the seasons 2012/13-2015/16, and the game ended in regulation.

Collection: locations
Fields: _id, capacity, name
Filter Example:
{
	"capacity": { $gte: 20000 }
}
Filter Explanation:

This filter searches for all locations that had attendance of 20,000 people or over in their history.

Collection: misses
Fields: _id, name
Filter Example:
{
	"name": "OVER"
}
Filter Explanation:

This is a catalog query filter. The catalog collections have two fields: name and _id, and you can query by either, or retrieve all items at once, as they are seldom updated. The filter above searchs for the entry of the miss "OVER" (over the net) to retrieve the _id that is used in other collections.

Collection: penalties
Fields: _id, name
Filter Example:

This is a catalog collection.

Collection: players
Fields: _id, active, birthdate, city, country, draftteam, draftyear, games[], height, injury_history[], injury_status, name, number, pick, position, rookie, round, shoots, starts[], state, team, teams[], undrafted, weight
Filter Example:
{
	"undrafted" : 1,
	"country" : "CZE",
	"teams" : "ARI"
}
Filter Explanation:

This filter searches for undrafted players born in the territory of Czech Republic (that includes the Czech part of Czechoslovakia) that ever played for the Arizona Coyotes franchise.

Collection: schedule
Fields: away, date, game_id, home, season, stage, ts, year
Filter Example:
{
	"season_id" : 1,
	"$or" : [
		{
			"away": BOS
		},
		{
			"home": BOS
		}
	]
}
Filter Explanation:

This filter searches for the games where the Boston Bruins participated in the season opener either as the home or as the away team.

Filter Explanation:
Collection: seasons
Fields: year, conferences
Filter Example:
{
	"conferences": "5bf71a159ad6904d9124db0f"
}
Filter Explanation:

This filter searches all the season where the conference is of the id given above (the one you fished before, probably.

Collection: shot_types
Fields: _id, name
Filter Example:

This is a catalog collection.

Collection: stopreasons
Fields: _id, name
Filter Example:

This is a catalog collection.

Filter Explanation:
Collection: strengths
Fields: _id, name
Filter Example:

This is a catalog collection.

Collection: teams
Fields: _id, defunct, folded, founded, full[], long[], short[]
Filter Example:
{
	"folded" : 1,
	"founded" : { "$gte" : 1930 }
}
Filter Explanation:

This filter searches for teams that were founded since 1930 and folded.

Collection: zones
Fields: _id, name
Filter Example:

This is a catalog collection.



Apply!

It's easy to become the MoreHockeyStats API user!

  • Send us an email at contact@morehockeystats.com with the request.
  • Send a payment via Paypal to the same email address.
Your account will be created and the payment sum added to your balance.

In certain cases we may agree to provide you a free access to the data:

  • When you decide to share the access to your own valuable NHL data with MoreHockeyStats.
  • When you make an obligation to use our data in your own projects that will advertise MoreHockeyStats website and our API service.
The decision to provide the free access is not guaranteed and will be made to our discretion.

Copyright © 2015-2024 MoreHockeyStats.com | about | contact | blog | forum | Terms Of Use | glossary | links
More Hockey Stats Hockey Elo Ratings NHL Errata