You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.
As you can see I tried to create a document with a subdocument named cards, that again has subdocuments that will have a randomly generated key ('key01' etc. in this example) as an identifier.
Now I would like to put all the subdocuments of cards into a List [ ] that I could pass on to another screen of the app. Is this possible with objectdb and if so, could you give me a hint on how to implement it?
The text was updated successfully, but these errors were encountered:
I am not sure if I understand your question correctly.
Projection like in the MongoDB API isn't possible yet.
I haven't actually tested the following code.
But maybe you can use some of it.
var results =await db.find({'some':'filter'});
var cards = [];
for(var result in results){
if(result.containsKey('cards') && result['cards'] isMap){
for(var key in result['cards'].keys){
cards.add(result['cards'][key]);
}
}
}
print(cards);
If it is a single result you can also do this:
var result =await db.first({'some':'filter'});
var cards = [];
if(result.containsKey('cards') && result['cards'] isMap){
for(var key in result['cards'].keys){
cards.add(result['cards'][key]);
}
}
print(cards);
This isn't really an issue, just me having a problem and no better place to ask the question :)
I am currently implementing objectdb and created this test document:
As you can see I tried to create a document with a subdocument named
cards
, that again has subdocuments that will have a randomly generated key ('key01' etc. in this example) as an identifier.Now I would like to put all the subdocuments of
cards
into aList [ ]
that I could pass on to another screen of the app. Is this possible with objectdb and if so, could you give me a hint on how to implement it?The text was updated successfully, but these errors were encountered: