Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RxJs #511

Closed
polRk opened this issue Apr 24, 2019 · 3 comments
Closed

Add RxJs #511

polRk opened this issue Apr 24, 2019 · 3 comments
Assignees

Comments

@polRk
Copy link

polRk commented Apr 24, 2019

Я предлагаю добавить возможность работать с Observeble.
I suggest adding the ability to work with Observeble.

import {from, of} from 'rxjs'

from(firestore.collection('col')).pipe(
   map(col => col.docs),
   take(1),
   mergeMap(doc => of(doc.update()))
   tap(console.log)
)

firestore.pipe(
   map(col => col.docs),
   take(1),
   mergeMap(doc => of(doc.update()))
   tap(console.log)
)

Now i can use rxjs wrapper, but it's not cool

fromPromise(firestore.collection('col'))
 // or
new Observable(observer => {
  firestore.collection('col').get().then(r => {observer.next(r)}).then(r => observer.close())
}).pipe(
   map(col => col.docs),
   take(1),
   mergeMap(doc => of(doc.update()))
   tap(console.log)
)
@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@schmidt-sebastian
Copy link
Contributor

@polRk Thanks for sending this over! We do not have any immediate plans to add native support for Rx, but we will consider it in the future. Our API should already be usable with the Observer pattern, but it is true that you do have to jump through some hoops (as shown in your code snippet).

If anyone else would like to see better support in either the Admin SDK or the Mobile SDK, please do let us know.

@hiranya911
Copy link
Contributor

I'm going to close this since I don't see any pending action items for this repo. If Rx support is ever implemented for Firestore, it should be done in https://github.com/googleapis/nodejs-firestore where the Firestore code lives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants