Hi Andreas,

someone (presumably you) asked the same question on StackOverflow:

http://stackoverflow.com/q/37256252

For anyone else here's my accepted answer from SO:

--

The documentation refers to collections. You seem to be using a Foxx 
repository. Foxx repositories are wrappers around collections that provide 
most of the same methods but instead of returning plain documents (or 
cursors) they wrap the results in Foxx models.

In your case it looks like you probably don't want to use Foxx models at 
all (you're just converting them back to documents, likely just removing a 
few attributes like _rev and _id) so you could simply forego the repository 
completely and use the collection you're passing into it directly:

var geodata = applicationContext.collection('geodata');


/** Lists of all geodata.
 *
 * This function simply returns the list of all Geodatum.
 */
controller.get('/', function (req, res) {
  var parameters = req.parameters;
  var limit = parameters['limit'];
  var result = geodata.all().limit(10);
  if (limit != "undefined") {
    result = result.slice(0, limit);
  }
  res.json(_.map(result, function (doc) {
    return _.omit(doc, ['_id', '_rev']);
  }));
});


You're not the first person to be confused by the distinction between 
repositories and collections, which is why repositories and models will go 
away in the upcoming 3.0 release (but you can still use them in legacy 
2.8-compatible services if you need to).

--

Cheers,

Alan

-- 
You received this message because you are subscribed to the Google Groups 
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to