Replies: 1 comment 1 reply
-
Hi @skully250 which version of SurrealDB server are you running? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I've been migrating from a particularly bad usecase of MongoDB to Surreal slowly and doing a lot of testing on the speed improvements and data structure returned. My issue is thus;
When using FETCH it seems to always return an array which is fine for some items but not for others, an example would be a data structure similar to below -
using something like
FETCH items
does work as expected, but expanding on thatFETCH items, items.type
returns the latter as an arrayIs there a way to unwrap/unpack this return as an object when its fetching a singular item? such that type would be an object and not an array with a single entry of object - Or is there a better query that i should be using in order to get the desired result
Edit: using a subquery with a limit does work but it becomes unwieldy on multiple queries
EG:
(SELECT * FROM $parent.items[*].type LIMIT 1) as items[*].type
this does return as a singular object, and this is a solution though it does become somewhat unwieldy when theres 3-4 so still taking any possible suggestions to make this simpler
Thanks
Beta Was this translation helpful? Give feedback.
All reactions