mirror of https://gitee.com/bigwinds/arangodb
expose the any() method from the collection on the repository too
This commit is contained in:
parent
959631c4d9
commit
d0eb69fc73
|
@ -138,6 +138,8 @@ var FulltextRepository = Foxx.Repository.extend({
|
|||
|
||||
@startDocuBlock JSF_foxx_repository_all
|
||||
|
||||
@startDocuBlock JSF_foxx_repository_any
|
||||
|
||||
!SUBSECTION Removing entries from the repository
|
||||
|
||||
@startDocuBlock JSF_foxx_repository_remove
|
||||
|
|
|
@ -273,6 +273,28 @@ _.extend(Repository.prototype, {
|
|||
}, this);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @startDocuBlock JSF_foxx_repository_any
|
||||
/// `FoxxRepository#any()`
|
||||
///
|
||||
/// Returns a random document from this collection (or null if there is none).
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// ```javascript
|
||||
/// repository.any();
|
||||
/// ```
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
any: function () {
|
||||
'use strict';
|
||||
var data = this.collection.any();
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
return (new this.model(data));
|
||||
},
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SUBSECTION-- Removing Entries
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue