Skip to content

Instantly share code, notes, and snippets.

@bloggerklik
Last active November 25, 2023 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bloggerklik/9d374d77935791280f09b3c6c1163194 to your computer and use it in GitHub Desktop.
Save bloggerklik/9d374d77935791280f09b3c6c1163194 to your computer and use it in GitHub Desktop.
Realm
// Step 1 *************************************************************************************
// Current data
[
{
"id": "6407d4949096750f578c536c",
"name": "name1",
"modelB": [
{ "label": "label1", "boolValue": true },
{ "label": "label2", "boolValue": true },
{ "label": "label3", "boolValue": true },
*
//5000 pieces
{ "label": "label5000", "boolValue": true },
]
},
{
"id": "7407d4949096750f578c536c",
"name": "name2",
"modelB": [
{ "label": "label1", "boolValue": true },
{ "label": "label2", "boolValue": true },
{ "label": "label3", "boolValue": true },
*
//5000 pieces
{ "label": "label5000", "boolValue": true },
]
}
]
// Step 2 *************************************************************************************
// useQuery("ModelA")
// Output
[
{
"id": "6407d4949096750f578c536c",
"name": "name1",
"modelB": [
{ "label": "label1", "boolValue": true },
{ "label": "label2", "boolValue": true },
{ "label": "label3", "boolValue": true },
*
//5000 pieces
{ "label": "label5000", "boolValue": true },
]
},
{
"id": "7407d4949096750f578c536c",
"name": "name2",
"modelB": [
{ "label": "label1", "boolValue": true },
{ "label": "label2", "boolValue": true },
{ "label": "label3", "boolValue": true },
*
//5000 pieces
{ "label": "label5000", "boolValue": true },
]
}
]
// Step 3 *************************************************************************************
// What should be the query for the following output?
// Output
[
{
"id": "6407d4949096750f578c536c",
"name": "name1",
"modelB": [
{ "label": "label3000", "boolValue": true },
]
},
{
"id": "7407d4949096750f578c536c",
"name": "name2",
"modelB": [
{ "label": "label3000", "boolValue": true },
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment