1
0
Fork 0

fix errors pointed out by @pluma

This commit is contained in:
Patrick Huber 2014-12-02 11:43:02 +01:00
parent 000797eba7
commit 46aeb0f54d
1 changed files with 6 additions and 5 deletions

View File

@ -44,13 +44,14 @@ It is also possible to supply parameters to the query:
```javascript
// in the repository
getPendingItemById: Foxx.createQuery(
'FOR todo IN my_todos FILTER todo.completed == false FILTER todo._key == @key RETURN todo'
'FOR todo IN my_todos FILTER todo.completed == false FILTER todo._key == @id RETURN todo'
)
// in the controller
ctrl.get("/:id", function(req, res) {
var id = req.params("id");
res.json(todosRepository.getPendingItemById(id));
var rv = todosRepository.getPendingItemById({ id: id });
res.json(rv);
});
```
@ -59,7 +60,7 @@ The list of results can also be transformed before returning it from the reposit
```javascript
// in the repository
getPendingItemById: Foxx.createQuery({
query: 'FOR todo IN my_todos FILTER todo.completed == false FILTER todo._key == @key RETURN todo',
query: 'FOR todo IN my_todos FILTER todo.completed == false FILTER todo._key == @id RETURN todo',
transform: function(results, args) {
for (var i = 0; i < results.length; i++) {
results[i].extraProperty = args.extra;
@ -72,8 +73,8 @@ ctrl.get("/:id", function(req, res) {
var id = req.params("id");
var extra = req.params("extra");
var rv = todosRepository.getPendingItemById(
{ id: id },
{ extra: extra }
{ id: id },
{ extra: extra }
);
res.json(rv);
});