Skip to content
New issue

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

GetArrayTree field selection hides children #24

Open
burakkilic opened this issue Jan 16, 2016 · 3 comments
Open

GetArrayTree field selection hides children #24

burakkilic opened this issue Jan 16, 2016 · 3 comments

Comments

@burakkilic
Copy link

Hello;

I want to use this query in getArrayTree.

var query = {
    condition: {
    },
    fields: {
        _id: 1,
        name: 1,
        description: 1,
        price: 1,
        type: 1,
        image: 1,
        published: 1,
        children: 1
    },
    // sorting
    sort: {
        order: 1
    }
};

but children is not coming. Where am I wrong?

@janez89
Copy link
Owner

janez89 commented Jan 16, 2016

Hello,
the array tree method has 2 versions.
small caps version work on document instance.

Get root document and use you can use the doc.getArrayTree(...);

Or YourCollection.GetArrayTree('MongoId', ...);

I'm work on the new version this module with new API.

@burakkilic
Copy link
Author

I used document instance version:

doc.getArrayTree(query, function(err, tree) {
        if (err) res.json(err);
        return res.json({
            type: true,
            data: tree
        });
    });

and children is not sent.

When are you planning to release the new version by the way?

@ectan
Copy link

ectan commented May 10, 2017

I found getArrayTree will return children if you include parentId in your query.fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants