Blame view

server/methods/insert/example.js 468 Bytes
36b159afd   Ryan Glover   Add server/method...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  /*
  * Methods: Insert - Example
  * Example of a method used for inserting into the database.
  */
  
  Meteor.methods({
    exampleInsertMethod: function(argument){
      // Check the argument. Assuming an Object type here.
      check(argument, Object);
  
      // Perform the insert.
      try {
        var exampleId = Example.insert(argument);
        return exampleId;
      } catch(exception) {
        // If an error occurs, return it to the client.
        return exception;
      }
    }
  });