We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
When working with multiple levels, I can't get only the next descendants.
I am using a mongo db.
Let me explain ...
When working with 2 levels, it all works just fine.
I have the following structure, using 3 levels ( parent, child, grandchild ):
parent 1
parent 2
parent 3
The following structure stores all the parents. This is ok.
[ { "_id": "5bb5ac508ac2ef20f4005d26", "platform": "mobile", "name": { "en": "m1", "ar": "1" }, "image": { "en": "1", "ar": "1" }, "link": { "en": "1", "ar": "1" }, "parent_id": null, "_lft": 1, "_rgt": 6, "updated_at": "2018-10-04 06:04:35", "created_at": "2018-10-04 05:59:44" }, { "_id": "5bb5ac588ac2ef20f4005d27", "platform": "mobile", "name": { "en": "m2", "ar": "1" }, "image": { "en": "1", "ar": "1" }, "link": { "en": "1", "ar": "1" }, "parent_id": null, "_lft": 7, "_rgt": 10, "updated_at": "2018-10-04 06:04:35", "created_at": "2018-10-04 05:59:52" }, { "_id": "5bb5acb48ac2ef20f4005d2d", "platform": "mobile", "name": { "en": "m3", "ar": "1" }, "image": { "en": "1", "ar": "1" }, "link": { "en": "1", "ar": "1" }, "parent_id": null, "_lft": 19, "_rgt": 24, "updated_at": "2018-10-04 06:04:35", "created_at": "2018-10-04 06:01:24" } ]
The following structure stores one child and one grandchild. This is wrong.
Within this array, only the model with the _id 5bb5ac988ac2ef20f4005d2b should be returned, because that's the child.
5bb5ad738ac2ef20f4005d37 is the child of 5bb5ac988ac2ef20f4005d2b and this should not be here.
When callind $model->descendants for 5bb5ac508ac2ef20f4005d26 ... I get the following :
$model->descendants
[ { "_id": "5bb5ac988ac2ef20f4005d2b", "platform": "mobile", "name": { "en": "m1 c1", "ar": "1" }, "image": { "en": "1", "ar": "1" }, "link": { "en": "1", "ar": "1" }, "parent_id": "5bb5ac508ac2ef20f4005d26", "_lft": 2, "_rgt": 5, "updated_at": "2018-10-04 06:04:35", "created_at": "2018-10-04 06:00:56" }, { "_id": "5bb5ad738ac2ef20f4005d37", "platform": "mobile", "name": { "en": "m1 c1 g1", "ar": "1" }, "image": { "en": "1", "ar": "1" }, "link": { "en": "1", "ar": "1" }, "parent_id": "5bb5ac988ac2ef20f4005d2b", "_lft": 3, "_rgt": 4, "updated_at": "2018-10-04 06:04:35", "created_at": "2018-10-04 06:04:35" } ]
The grandchild 5bb5ad738ac2ef20f4005d37 should not be returned.
When asking parent 1 for the children, the return should contain only parent 1 child 1.
parent 1 child 1
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello,
When working with multiple levels, I can't get only the next descendants.
I am using a mongo db.
Let me explain ...
When working with 2 levels, it all works just fine.
I have the following structure, using 3 levels ( parent, child, grandchild ):
parent 1
parent 2
parent 3
The following structure stores all the parents.
This is ok.
[
{
"_id": "5bb5ac508ac2ef20f4005d26",
"platform": "mobile",
"name": {
"en": "m1",
"ar": "1"
},
"image": {
"en": "1",
"ar": "1"
},
"link": {
"en": "1",
"ar": "1"
},
"parent_id": null,
"_lft": 1,
"_rgt": 6,
"updated_at": "2018-10-04 06:04:35",
"created_at": "2018-10-04 05:59:44"
},
{
"_id": "5bb5ac588ac2ef20f4005d27",
"platform": "mobile",
"name": {
"en": "m2",
"ar": "1"
},
"image": {
"en": "1",
"ar": "1"
},
"link": {
"en": "1",
"ar": "1"
},
"parent_id": null,
"_lft": 7,
"_rgt": 10,
"updated_at": "2018-10-04 06:04:35",
"created_at": "2018-10-04 05:59:52"
},
{
"_id": "5bb5acb48ac2ef20f4005d2d",
"platform": "mobile",
"name": {
"en": "m3",
"ar": "1"
},
"image": {
"en": "1",
"ar": "1"
},
"link": {
"en": "1",
"ar": "1"
},
"parent_id": null,
"_lft": 19,
"_rgt": 24,
"updated_at": "2018-10-04 06:04:35",
"created_at": "2018-10-04 06:01:24"
}
]
The following structure stores one child and one grandchild.
This is wrong.
Within this array, only the model with the _id 5bb5ac988ac2ef20f4005d2b should be returned, because that's the child.
5bb5ad738ac2ef20f4005d37 is the child of 5bb5ac988ac2ef20f4005d2b and this should not be here.
When callind
$model->descendants
for 5bb5ac508ac2ef20f4005d26 ... I get the following :[
{
"_id": "5bb5ac988ac2ef20f4005d2b",
"platform": "mobile",
"name": {
"en": "m1 c1",
"ar": "1"
},
"image": {
"en": "1",
"ar": "1"
},
"link": {
"en": "1",
"ar": "1"
},
"parent_id": "5bb5ac508ac2ef20f4005d26",
"_lft": 2,
"_rgt": 5,
"updated_at": "2018-10-04 06:04:35",
"created_at": "2018-10-04 06:00:56"
},
{
"_id": "5bb5ad738ac2ef20f4005d37",
"platform": "mobile",
"name": {
"en": "m1 c1 g1",
"ar": "1"
},
"image": {
"en": "1",
"ar": "1"
},
"link": {
"en": "1",
"ar": "1"
},
"parent_id": "5bb5ac988ac2ef20f4005d2b",
"_lft": 3,
"_rgt": 4,
"updated_at": "2018-10-04 06:04:35",
"created_at": "2018-10-04 06:04:35"
}
]
The grandchild 5bb5ad738ac2ef20f4005d37 should not be returned.
parent 1
parent 2
parent 3
When asking
parent 1
for the children, the return should contain onlyparent 1 child 1
.The text was updated successfully, but these errors were encountered: