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

publishComposite #113

Closed
proft opened this issue Oct 2, 2016 · 1 comment
Closed

publishComposite #113

proft opened this issue Oct 2, 2016 · 1 comment
Labels

Comments

@proft
Copy link

proft commented Oct 2, 2016

Hello!

Is there any possibility to get data from publishComposite?

My publish (meteor side)

Meteor.publishComposite('messagesToUser', function(to) {
    return {
        find: function() {
            return Messages.find({to: to}, {sort: {created: 1}})
        },
        children: [{
            find: function(item) {
                return Entities.find({_id: item.entity});
            }
        }]
    }
})

My subscribe (android side)

        meteor.subscribe("messagesToUser", new Object[]{userID}, new SubscribeListener() {
            @Override
            public void onSuccess() {
                Document[] messages = db.getCollection("Messages").whereEqual("to", userID ).find();

                // prepare list
                for (Document msg : messages) {
                    Log.i("VVV", "MSG " + msg.toString());
                }
            }

            @Override
            public void onError(String s, String s1, String s2) {}
        });

Output

MSG {to=v7zBKuRKD7ayyWaM2, entity=amF6cWiHWCNwZLgmf, message=1111, from=vo4TAbJaT7LiDXJiv, created={$date=1475350399184}, isRead=false}

How to get linked Entities object?

@ocram ocram added the question label Oct 7, 2016
@ocram
Copy link
Contributor

ocram commented Oct 7, 2016

Thanks for reporting this!

Is that publishComposite from englue/meteor-publish-composite?

If so, you may find Meteor-Community-Packages/meteor-publish-composite#67 helpful. It suggests that there's a problem in that library which causes the operation to be marked as completed when actually only the primary cursor has returned and the secondary cursor is still not done.

Can you check that? Perhaps the data from the second cursor arrives a little later?

Anyway, doesn't seem like something we can fix here.

@ocram ocram closed this as completed Oct 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants