How to controle the size of collection? #452
Unanswered
ericchaves
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
First off, congrats for such great project. I'm already a big fan of it.
After playing around a little bit, I would like to ask for some help with some questions. I'm not a rust programmer so forgive me as my questions are more "user centered".
I have a synth project with entities that looks like this: I have an an entity
Tenant
where each tenant has manyCampaign
(s), and eachCampaign
has manyProposal
(s).I've tried a couple of variant synth setups. The first one I followed the bandk_db aproach and created a namespace
campaigns
with a JSON file for each collection.Each JSON file declares an array with the contents specified "directly" in the file itself, like this:
Lets say I ran
synth generate campaigns --collection tenants
I expecte to get 9 objects (10-1) but I'm actually getting 6.I tried to run the same command with the
--size 10
flag but now I got 13.So I tried a couple of times with different sizes and the results didn't make sense to me.
I then tried to organize the JSON files in a different way, like this:
where in the
tenant.json
I've just declared an object schema and in thetenants.json
I've declared an array using thesame_as
short-hande notation, like this:and tried the same colletion's sizes generations (
synt generate campaigns --collection tenants --size 10 | jq 'length'
) but the results now were .Also, in this second example If I try to control the size of the collection by using the
tenant
collection (with the object only spec) I always got only one object.synt generate campaigns --collection tenant --size 10 | jq {}
and if try to synth the tenants collection (the array declaration) I ended having duplicates the same entity (ie I end up with an array of multiple copies of the same item).
So my questions are:
--size
flag?Thanks in advance for the help.
Beta Was this translation helpful? Give feedback.
All reactions