Using non-persistent mongo

I’m trying to use to a non-persistent collection on server-side:

Searches = new Mongo.Collection('searches', {connection:null});

then publish it:

Meteor.publish('searches', function(){
	return Searches.find({})
})

and subscribe to it on the client-side:

Template.Results.onCreated(function() {
    var self = this;
    self.autorun(function() {
        self.subscribe('searches');        
    });
});

I’m doing so in order to update this collection async on server-side and see the results reactively on the client-side:

server-side (Meteor method that is called by client but running on the server - and I do see the insert works and Searches count increases):
Searches.insert({'x':'insert'})

client-side:

Template.Results.helpers({
  searchResults:function(){
    return Searches.find({})
  },
})

This doesn’t work and I get nothing on the Searches collection on the client side. What am I doing wrong?

Hi, I can’t provide an answer, but I went in same issues and was hoping the original author got an answer or someone lese will be able to provide some.

I’d like to have an non-persistent collection, which will be be synced to all clients. Something, where you don’t need to persist the data between and would like to save the overhead with database writes.

After countless hours of trying everything possible I found a way to what I wanted:

export const Presentations = new Mongo.Collection('presentations', Meteor.isServer ? {connection: null} : {});

Still, not sure if this is the right/good way to do this.

I checked the MongoDb and no presentations collection is being created. Also, n every server-restart the collection is empty. There is a small downside on the client, even the collectionHanlde.ready() is truthy the findOne() first returns undefined and is being synced afterwards.