Excluding "_id" from meteor search query?


I want to exclude the field “id” within publications. The syntax used is according to mongoDB spec. Trying results in an Error: You may not observe a cursor with {fields: {id: 0}}
Is that even possible with Meteor?

Here’s the code for only excluding id:

if (Meteor.isServer) {

// other stuff

Meteor.publish(“userData”, function() {
if (this.userId) {
return Meteor.users.find({}, {
fields: {
‘username’: 1,
‘menu’: 1,
‘cu’: 1,
‘x’: 1,
‘y’: 1,
’_id’: 0
} else {

If found a similar topic on SO (http://stackoverflow.com/questions/15193230/excluding-id-from-meteor-search-query) but the question isn’t answered.

I’m still a beginner with Meteor. Any help would be appreciated. Thanks in advance.


From Meteor documentation:

With one exception, it is not possible to mix inclusion and exclusion styles: the keys must either be all 1 or all 0. The exception is that you may specify _id: 0 in an inclusion specifier, which will leave _id out of the result object as well. However, such field specifiers can not be used with observeChanges, observe, cursors returned from a publish function, or cursors used in {{#each}} in a template. They may be used with fetch, findOne, forEach, and map.

Use different collection to share between users, even profile part of user account will be removed in the future, to enforce better security of account handling.


Thank you for the fast reply! So it isn’t possible after all.
Sry for not finding that inside the documentation myself.

I will try to find a way around then. : )


Good news is that _id of post have to be shared, but if you are using different collection, that _id does not mean profile_id.
You can still track profile_id in non-shared field so untrackable to client accounts from app.