Reputation: 11
I have a task like this:
Create a meterojs app. This app should provide an ability for users
to add messages
(without explicit server side call) and to remove it (only using server side call).
I'm a newbie with meteorjs and i dont understand how can an entity be put to the collection without a server side call.
Is there any way to do this?
Upvotes: 1
Views: 75
Reputation: 2386
it's an odd task, but it works like this: Meteor maintains a client-side "mini mongo" that
let's say you define a collection, messages, in a file that is served to both the client and the server:
Messages = new Mongo.Collection('messages');
Meteor will:
by default, any operations you make client-side will be reflected server-side, behind the scenes. thus, your user can add a message without an explicit server-side call (i.e. its implicit).
that data will actually exist in the real mongo database. so now you have the ability, from the server, to delete it. if there is an active publish on that collection, the client will be updated with that deletion.
Upvotes: 1