Skip to content

Commit fe59e95

Browse files
Update docs/develop/node/redis-om/index-redis-om.mdx
Co-authored-by: Simon Prickett <simon@crudworks.org>
1 parent 8cfaafb commit fe59e95

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/develop/node/redis-om/index-redis-om.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ And you should get back...
336336
}
337337
```
338338

339-
...complete wrong results! What's up with that? Well, our entity doesn't know how to serialize itself to JSON so Express is doing that for us. And since `JSON.stringify`, which Express is using, can't see the properties that the `Schema` class added to our entity, it's just rendering the internal implementation of the entity. We can fix that by making our `Song` smarter.
339+
...completely wrong results! What's up with that? Well, our entity doesn't know how to serialize itself to JSON so Express is doing that for us. And since `JSON.stringify`, which Express is using, can't see the properties that the `Schema` class added to our entity, it's just rendering the internal implementation of the entity. We can fix that by making our `Song` smarter.
340340

341341
To make `Song` smarter, add a `.toJSON` method to it. This creates something that `JSON.stringify` can deal with and that looks exactly how we want it to. And while we're at it, let's add a computed field as well, just to show off that capability:
342342

0 commit comments

Comments
 (0)