|
1 | 1 | In this stage, you'll add support for responding to the `GEOADD` command.
|
2 | 2 |
|
3 | 3 | ### The `GEOADD` command
|
4 |
| -The `GEOADD` command adds a location (with longitude, latitude, and name) to a key. It stores the location as a [sorted set](https://redis.io/docs/latest/develop/data-types/sorted-sets/) under the specified key. If the key doesn’t exist, a new sorted set is created under the specified name and the location is inserted to it. If the key exists, the location is inserted in the sorted set. |
| 4 | + |
| 5 | +The [`GEOADD` command](https://redis.io/docs/latest/commands/geoadd/) adds a location (with longitude, latitude, and name) to a key. It stores the location as a [sorted set](https://redis.io/docs/latest/develop/data-types/sorted-sets/) under the specified key. |
5 | 6 |
|
6 | 7 | Example usage:
|
7 | 8 |
|
8 | 9 | ```bash
|
9 | 10 | > GEOADD places -0.0884948 51.506479 "London"
|
10 | 11 | (integer) 1
|
11 | 12 | ```
|
12 |
| -The argument order of `GEOADD` argument – key, longitude, latitude, member (longitude first, then latitude). |
| 13 | + |
| 14 | +The arguments `GEOADD` accepts are: |
| 15 | + |
| 16 | +1. `key`: The key to store the location in. |
| 17 | +2. `longitude`: The longitude of the location. |
| 18 | +3. `latitude`: The latitude of the location. |
| 19 | +4. `member`: The name of the location. |
13 | 20 |
|
14 | 21 | It returns the count of elements added, encoded as a RESP Integer.
|
15 | 22 |
|
| 23 | +In this stage, you'll only implement the response to the `GEOADD` command. We'll get to validating arguments and storing locations in later stages. |
| 24 | + |
16 | 25 | ### Tests
|
| 26 | + |
17 | 27 | The tester will execute your program like this:
|
18 | 28 |
|
19 | 29 | ```bash
|
20 | 30 | $ ./your_program.sh
|
21 | 31 | ```
|
22 | 32 |
|
23 |
| -It will then send a `GEOADD` command specifying a key, latitude, longitude, and location name. |
| 33 | +It will then send a `GEOADD` command: |
24 | 34 |
|
25 | 35 | ```bash
|
26 | 36 | $ redis-cli GEOADD places 11.5030378 48.164271 Munich
|
27 | 37 | ```
|
28 | 38 |
|
29 |
| -The tester will expect the response to be `:1\r\n`, which is 1(number of locations added) encoded as a RESP integer. |
| 39 | +The tester will expect the response to be `:1\r\n`, which is 1 (number of locations added) encoded as a RESP integer. |
30 | 40 |
|
31 | 41 | ### Notes
|
32 |
| -- In this stage, you will only implement responding the the `GEOADD` command. You don't need to store the locations yet. We'll get to storing the locations in the later stages. |
| 42 | + |
| 43 | +- In this stage, you only need to implement responding to the `GEOADD` command. We'll get to validating arguments and storing locations in later stages. |
0 commit comments