Easy publishing question?

Perhaps this is an easy publishing question? I have users who are each part of a firm. Each firm has a sub-document “authUsers”, which lists all the users in the firm and their authorization levels. I’m trying to publish the firm by searching the authUsers for the current user ID.

Meteor.publish(“firm”, function () {
var user = Meteor.users.findOne(this.userId);

if (this.userId)
return Firms.findOne({“authUsers.userId” : user._id});

This is giving me a cursors error, and doesn’t seem to be returning anything. I do have a user logged in, so that doesn’t seem to be the issue. Sorry if this is a basic question, just starting with Meteor.

This should be enough:

Meteor.publish("firm", function () {
  if (this.userId)
    return Firms.findOne({"authUsers.userId" : this.userId});

I’m still getting the same error: “Publish function can only return a Cursor or an array of Cursors”.

return Firms.find({"authUsers.userId" : this.userId});

use find. When you return the result of findOne it returns a document object, and the publish function needs to return a cursor or array of cursors