You can now specify a function for each rest method, which will be called right before the collection will be modified/queried. If you return false the action will be canceled, with returning true the action will take place. Editing the object before POST/PUT actions is also possible.

Example:

collectionApi.addCollection(ToDos, 'todos', {methods: ['POST', 'GET', 'PUT', 'DELETE'], before: {
	POST: function(todo) {
		if(todo.PropX === 'something') {
			todo.PropY = 'something else';
			return true;
		}
		return false;
	},

	GET: function(collectionID, todos) {
		for(i=0; i < todos.length;i++)
		{
			if(todos[i].Secret) {
				todos[i] = null;
			}
		}
		return true;
	},

	PUT: function(collectionID, todo, newValues) {
		if (todo.PropX === 'something')
		{
			return true;
		}
		return false;
	},

	DELETE: function(collectionID, todo) {
		if (todo.safe)
		{
			return false;
		}
		return true;
	}
}});

Signed-off-by: Andreas Glunz <andreas@mansion10.de>
Fix content length in response.
Merge branch 'feature/CallbackBeforeHandling' of git://github.com/andreasgl/meteor-collectionapi into andreasgl-feature/CallbackBeforeHandling

Conflicts:
	collectionapi.js
if a GET before handler fails from a PUT request, return 204 (No Content) or 404
updated version number