New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

observable-mongo

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

observable-mongo

Functions that provide 'node mongodb driver APIs' as Observables

latest
Source
npmnpm
Version
2.3.17
Version published
Maintainers
1
Created
Source

Build Status Coverage Status

observable-mongo

Functions that provide some 'node mongodb driver APIs' as Observables.

To run the tests it is required to have a working instance of Mongo to connect to. The default is to have a local mongo installed at port 27017 as specified in the default "config.ts" file in the "src" folder.

In case you want to run the tests on other mongo instances, change "config.ts" and run the command "npm run tsc" to rigenerate the "dist" directory with the configuration information

examples

For use cases that see different asyncrhonous elements interacting, using the Observable pattern can simplify and clarify the code.

A simple use case can be the following:

  • you need to read from a Mongo collection a list of authors
  • for each author you need to query a REST API to fetch the titles on the author
  • than you need to write the titles in a file with the author name

In this case you need to interact with Mongo, http requests and the Node fs library, which all offer asynchrnous APIs. If these APIs offer also an Observable version, that the code of the example can be written as a single stream, leading to a more readable code (personal opinion).

The example in the repo represents this use case using observable-http-request and observable-fs, which are companion libraries of observable-mongo.

Keywords

mongo

FAQs

Package last updated on 09 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts