Skip to content

Commit

Permalink
bugfix(types): Fixes array type of Observable in find()
Browse files Browse the repository at this point in the history
  • Loading branch information
dotansimha committed Nov 3, 2016
1 parent 3802b70 commit 7a3f0f5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions dist/ObservableCollection.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export declare module MongoObservable {
*
* @param {Collection~MongoQuerySelector} selector - A query describing the documents to find
* @param {Collection~MongoQueryOptions} options - Query options, such as sort, limit, etc.
* @returns {ObservableCursor<T[]>} RxJS Observable wrapped with Meteor features.
* @returns {ObservableCursor<T>} RxJS Observable wrapped with Meteor features.
* @example <caption>Using Angular2 Component</caption>
* const MyCollection = MongoObservable.Collection("myCollection");
*
Expand All @@ -156,7 +156,7 @@ export declare module MongoObservable {
fields?: FieldSpecifier;
reactive?: boolean;
transform?: Function;
}): ObservableCursor<T[]>;
}): ObservableCursor<T>;
/**
* Finds the first document that matches the selector, as ordered by sort and skip options.
*
Expand Down
2 changes: 1 addition & 1 deletion dist/ObservableCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export var MongoObservable;
*
* @param {Collection~MongoQuerySelector} selector - A query describing the documents to find
* @param {Collection~MongoQueryOptions} options - Query options, such as sort, limit, etc.
* @returns {ObservableCursor<T[]>} RxJS Observable wrapped with Meteor features.
* @returns {ObservableCursor<T>} RxJS Observable wrapped with Meteor features.
* @example <caption>Using Angular2 Component</caption>
* const MyCollection = MongoObservable.Collection("myCollection");
*
Expand Down
2 changes: 1 addition & 1 deletion dist/bundles/index.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ var ObservableCursor = (function (_super) {
*
* @param {Collection~MongoQuerySelector} selector - A query describing the documents to find
* @param {Collection~MongoQueryOptions} options - Query options, such as sort, limit, etc.
* @returns {ObservableCursor<T[]>} RxJS Observable wrapped with Meteor features.
* @returns {ObservableCursor<T>} RxJS Observable wrapped with Meteor features.
* @example <caption>Using Angular2 Component</caption>
* const MyCollection = MongoObservable.Collection("myCollection");
*
Expand Down
6 changes: 3 additions & 3 deletions docs/ObservableCollection.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ T is a generic type - should be used with the type of the objects inside the col
* [.remove(selector)](#Collection+remove) ⇒ <code>Observable.&lt;Number&gt;</code>
* [.update(selector, modifier, options)](#Collection+update) ⇒ <code>Observable.&lt;Number&gt;</code>
* [.upsert(selector, modifier, options)](#Collection+upsert) ⇒ <code>Observable.&lt;{numberAffected, insertedId}&gt;</code>
* [.find(selector, options)](#Collection+find) ⇒ <code>ObservableCursor.&lt;Array.&lt;T&gt;&gt;</code>
* [.find(selector, options)](#Collection+find) ⇒ <code>ObservableCursor.&lt;T&gt;</code>
* [.findOne(selector, options)](#Collection+findOne) ⇒ <code>any</code>
* _inner_
* [~MongoQueryOptions](#Collection..MongoQueryOptions) : <code>Object</code>
Expand Down Expand Up @@ -137,11 +137,11 @@ Finds the first document that matches the selector, as ordered by sort and skip

<a name="Collection+find"></a>

### collection.find(selector, options) ⇒ <code>ObservableCursor.&lt;Array.&lt;T&gt;&gt;</code>
### collection.find(selector, options) ⇒ <code>ObservableCursor.&lt;T&gt;</code>
Method has the same notation as Mongo.Collection.find, only returns Observable.

**Kind**: instance method of <code>[Collection](#Collection)</code>
**Returns**: <code>ObservableCursor.&lt;Array.&lt;T&gt;&gt;</code> - RxJS Observable wrapped with Meteor features.
**Returns**: <code>ObservableCursor.&lt;T&gt;</code> - RxJS Observable wrapped with Meteor features.
**See**: [find on Meteor documentation](https://docs.meteor.com/api/collections.html#Mongo-Collection-find)

| Param | Type | Description |
Expand Down
6 changes: 3 additions & 3 deletions src/ObservableCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export module MongoObservable {
*
* @param {Collection~MongoQuerySelector} selector - A query describing the documents to find
* @param {Collection~MongoQueryOptions} options - Query options, such as sort, limit, etc.
* @returns {ObservableCursor<T[]>} RxJS Observable wrapped with Meteor features.
* @returns {ObservableCursor<T>} RxJS Observable wrapped with Meteor features.
* @example <caption>Using Angular2 Component</caption>
* const MyCollection = MongoObservable.Collection("myCollection");
*
Expand All @@ -249,10 +249,10 @@ export module MongoObservable {
fields?: FieldSpecifier;
reactive?: boolean;
transform?: Function;
}): ObservableCursor<T[]> {
}): ObservableCursor<T> {
const cursor = this._collection.find.apply(
this._collection, arguments);
return ObservableCursor.create<T[]>(cursor);
return ObservableCursor.create<T>(cursor);
}

/**
Expand Down

0 comments on commit 7a3f0f5

Please sign in to comment.