Skip to content

Commit c0b4986

Browse files
committed
improve migration doc
1 parent 08c97c2 commit c0b4986

1 file changed

Lines changed: 17 additions & 31 deletions

File tree

docs/v5-to-v6.md

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,36 +13,7 @@ Those are now aligned to return the proper types. For more details on protocol t
1313
## Default behavior changes (v5 default -> v6 default)
1414

1515
- `GEOSEARCH_WITH`, `GEORADIUS_WITH`, `GEORADIUS_RO_WITH`, `GEORADIUSBYMEMBER_WITH`, `GEORADIUSBYMEMBER_RO_WITH` - `distance`, `coordinates.longitude`, and `coordinates.latitude` are now `number` (previously `string`).
16-
17-
<!--V5:
18-
19-
```ts
20-
export interface GeoReplyWithMember {
21-
member: string;
22-
distance?: string;
23-
hash?: number;
24-
coordinates?: {
25-
longitude: string;
26-
latitude: string;
27-
};
28-
}
29-
```
30-
31-
V6:
32-
33-
```ts
34-
export interface GeoReplyWithMember {
35-
member: string;
36-
distance?: number;
37-
hash?: number;
38-
coordinates?: {
39-
longitude: number;
40-
latitude: number;
41-
};
42-
}
43-
```-->
44-
45-
- `CF.INSERTNX` changed from `Array<boolean>` to `Array<number>`.
16+
- `CF.INSERTNX` changed from `Array<boolean>` to `Array<number>`.
4617

4718

4819
## Stabilized APIs
@@ -61,6 +32,7 @@ In v5, some command transforms were unstable under RESP3. In v6, those commands
6132
| `@redis/search` | `FT.SEARCH NOCONTENT` | `ReplyUnion -> SearchNoContentReply` | RESP3 normalized through `FT.SEARCH` then projected to ids. |
6233
| `@redis/search` | `FT.SPELLCHECK` | `ReplyUnion -> SpellCheckReply` | RESP3 result/suggestion map variants normalized. |
6334
| `@redis/search` | `FT.HYBRID` | `ReplyUnion -> HybridSearchResult` | RESP3 map-like payload normalized to hybrid result object. |
35+
| `@redis/search` | `FT.INFO` | `ReplyUnion -> InfoReply` | RESP3 map-like payload normalized to stable info object shape. |
6436
| `@redis/search` | `FT.PROFILE SEARCH` | `ReplyUnion -> ProfileReplyResp2` | RESP3 profile/results wrappers normalized (Redis 7.4/8 layouts). |
6537
| `@redis/search` | `FT.PROFILE AGGREGATE` | `ReplyUnion -> ProfileReplyResp2` | RESP3 profile/results wrappers normalized (Redis 7.4/8 layouts). |
6638
| `@redis/search` | `FT.CONFIG GET` | `Record<string, string \| null> -> Record<string, string \| null>` | Static type is unchanged; map-like RESP3 payload is now normalized correctly. |
@@ -73,9 +45,23 @@ In v5, some command transforms were unstable under RESP3. In v6, those commands
7345
| `@redis/time-series` | `TS.MRANGE SELECTED_LABELS GROUPBY` | `{ labels: Record<string, string \| null>; sources: Array<string>; samples: Array<{ timestamp: number; value: number }> } -> { labels: Record<string, string \| null>; samples: Array<{ timestamp: number; value: number }> }` | `sources` removed from RESP3 selected-labels grouped reply. |
7446
| `@redis/time-series` | `TS.MREVRANGE SELECTED_LABELS GROUPBY` | `{ labels: Record<string, string \| null>; sources: Array<string>; samples: Array<{ timestamp: number; value: number }> } -> { labels: Record<string, string \| null>; samples: Array<{ timestamp: number; value: number }> }` | Inherits `TS.MRANGE SELECTED_LABELS GROUPBY` transform changes. |
7547

48+
## Object Prototype Normalization
49+
In v6, object-like replies are normalized to plain objects (`{}` / `Object.defineProperties({}, ...)`) instead of null-prototype objects (`Object.create(null)`).
50+
51+
Compatibility impact: this can be technically breaking for code/tests that assert a `null` prototype (for example `Object.getPrototypeOf(reply) === null` or deep-equality against `Object.create(null)`), but for most users key access/iteration/serialization behavior remains the same.
52+
53+
Commands affected:
54+
55+
- `@redis/client`: `CONFIG GET`, `FUNCTION STATS`, `HGETALL`, `LATENCY HISTOGRAM` (`histogram_usec`), `PUBSUB NUMSUB`, `PUBSUB SHARDNUMSUB`, `VINFO`, `VLINKS WITHSCORES`, `XINFO STREAM` (entry message objects), `XREAD`/`XREADGROUP` (message objects)
56+
- `@redis/search`: `FT.AGGREGATE`, `FT.AGGREGATE WITHCURSOR`, `FT.CURSOR READ`, `FT.CONFIG GET`, `FT.HYBRID`, `FT.INFO`, `FT.SEARCH`, `FT.PROFILE SEARCH`, `FT.PROFILE AGGREGATE`
57+
- `@redis/time-series`: `TS.MGET`, `TS.MGET WITHLABELS`, `TS.MGET SELECTED_LABELS`, `TS.MRANGE`, `TS.MREVRANGE`, `TS.MRANGE GROUPBY`, `TS.MREVRANGE GROUPBY`, `TS.MRANGE WITHLABELS`, `TS.MREVRANGE WITHLABELS`, `TS.MRANGE WITHLABELS GROUPBY`, `TS.MREVRANGE WITHLABELS GROUPBY`, `TS.MRANGE SELECTED_LABELS`, `TS.MREVRANGE SELECTED_LABELS`, `TS.MRANGE SELECTED_LABELS GROUPBY`, `TS.MREVRANGE SELECTED_LABELS GROUPBY`
58+
- `@redis/bloom`: `BF.INFO`, `CF.INFO`, `CMS.INFO`, `TOPK.INFO`, `TDIGEST.INFO`
59+
60+
Additionally, RESP3 map decoding now creates plain objects by default, so commands that expose raw RESP3 maps as JS objects inherit the same prototype change.
61+
7662

7763

78-
If you need to preserve v5 default behavior while migrating, pin RESP2 explicitly:
64+
## If you need to preserve v5 default behavior while migrating, pin RESP2 explicitly:
7965

8066
```javascript
8167
// Single node

0 commit comments

Comments
 (0)