Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/s-soltys/angular2-minimongo
The minimongo library for Angular 2+
https://github.com/s-soltys/angular2-minimongo
Last synced: about 1 month ago
JSON representation
The minimongo library for Angular 2+
- Host: GitHub
- URL: https://github.com/s-soltys/angular2-minimongo
- Owner: s-soltys
- Created: 2017-02-12T10:32:47.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-19T23:44:05.000Z (almost 8 years ago)
- Last Synced: 2024-10-18T06:51:43.594Z (2 months ago)
- Language: TypeScript
- Size: 34.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# angular2-minimongo
[![Build Status](https://travis-ci.org/s-soltys/angular2-minimongo.svg?branch=master)](https://travis-ci.org/s-soltys/angular2-minimongo)Use minimongo in your Angular 2 app.
This package exposes the [minimongo](https://github.com/mWater/minimongo) library as an Angular2 module with providers.# How to install:
```
$ npm install --save angular2-minimongo
```# How to use:
### Import the Minimongo module in your bootstrap module:
```typescript
import { MinimongoModule } from 'angular2-minimongo';@NgModule({
imports: [
MinimongoModule.forRoot({ namespace: '#your-database-namespace' }),
]
})
export class AppModule { }
```### Import and use the Minimongo service:
```typescript
import { MinimongoService } from 'angular2-minimongo';@Injectable()
export class TaskService {
tasksCollection = this.minimongo.getCollection('tasks');constructor(private minimongo: MinimongoService) {
}
}
```### Usage: the collection interface
```typescript
/*
Types are the best documentation.
Collections provided by the Minimongo service implement the ObservableCollection interface.
Parameters named selector and docs are standard mongo selectors.
*/
export interface ObservableCollection {
findOne(id: string): Observable;
findOne(selector: any, options?: any): Observable;
find(selector?: any, options?: any): Observable;
upsert(doc: T): Observable;
upsert(docs: T[]): Observable;
remove(id: string): Observable;
}
```# How to build and test:
Project is based on the angular-cli.
To run tests on this package just run:
```
ng test
```# Roadmap:
- Implement additional and more robust collection methods