, , . , , , : , Collection.remove({}); , Meteor.call ( Meteor.methods) , .
, , OWNER / , .
, , , Meteor.methods .
Meteor.method , , , , ( , ).
, Meteor , , Meteor.methods.
EditableDocument=function(userId){
return Match.Where(function(documentId){
var document=Collection.findOne(documentId);
if(!document){
throw new Meteor.Error(500,"Document doesn't exist !");
}
if(userId!=document.creator._id){
throw new Meteor.Error(500,"Can't update a document you don't own.");
}
return true;
});
};
Meteor.methods({
updateCollection:function(documentId,fields){
check(documentId,EditableDocument(this.userId));
check(fields,{
field1:Match.Optional(String),
field2:Match.OneOf(Number,Boolean),
field3:Match.Any
});
...
}
});
, Meteor DDP (Data Distributed Protocol) , Remote Method Invocation.
Meteor.call Meteor.method, , .
, HTTP, HTTPS , .
DDP , , *.meteor.com, meteor.com, , SSL.
.
https://groups.google.com/forum/#!topic/meteor-core/a9dPA1-mgXA
, , , .
, -, Meteor.