Skip to content

Commit 4cf5d2b

Browse files
committed
Add compatibility matrix to README
1 parent 235244e commit 4cf5d2b

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

README.md

+16-10
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22

33
Apollo [data source](https://www.apollographql.com/docs/apollo-server/data/fetching-data) for MongoDB
44

5-
Note: This README applies to the current version 0.6.0 and is meant to be paired with Apollo Server 4.
6-
See the old [README](README.old.md) for versions 0.5.4 and below, if you are using Apollo Server 3.
7-
8-
**Installation**
9-
```
10-
npm i apollo-datasource-mongodb
11-
```
12-
135
This package uses [DataLoader](https://github.com/graphql/dataloader) for batching and per-request memoization caching. It also optionally (if you provide a `ttl`) does shared application-level caching (using either the default Apollo `InMemoryLRUCache` or the [cache you provide to ApolloServer()](https://www.apollographql.com/docs/apollo-server/performance/cache-backends#configuring-external-caching)). It does this for the following methods:
146

157
- [`findOneById(id, options)`](#findonebyid)
@@ -19,9 +11,9 @@ This package uses [DataLoader](https://github.com/graphql/dataloader) for batchi
1911
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
2012
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
2113

22-
**Contents:**
23-
14+
- [Compatibility](#compatibility)
2415
- [Usage](#usage)
16+
- [Install](#install)
2517
- [Basic](#basic)
2618
- [Batching](#batching)
2719
- [Caching](#caching)
@@ -32,11 +24,25 @@ This package uses [DataLoader](https://github.com/graphql/dataloader) for batchi
3224
- [findByFields](#findbyfields)
3325
- [Examples](#examples)
3426
- [deleteFromCacheById](#deletefromcachebyid)
27+
- [deleteFromCacheByFields](#deletefromcachebyfields)
3528

3629
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
3730

31+
## Compatibility
32+
33+
| Apollo Server Version | `apollo-datasource-mongodb` |
34+
|-----------------------|-----------------------------------------------------------------------------------------|
35+
| 4.* | >= 0.6.0 |
36+
| 3.* | <= [0.5.4](https://github.com/GraphQLGuide/apollo-datasource-mongodb/tree/0.5.4#readme) |
37+
3838
## Usage
3939

40+
### Install
41+
42+
```
43+
npm i apollo-datasource-mongodb
44+
```
45+
4046
### Basic
4147

4248
The basic setup is subclassing `MongoDataSource`, passing your collection or Mongoose model to the constructor, and using the [API methods](#API):

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"test": "jest --watch",
1111
"ci": "jest --ci",
1212
"prepublishOnly": "npm run build",
13-
"prettify": "prettier --write **/*.js",
13+
"format": "prettier --write **/*.js",
1414
"release": "release patch && echo 'A Github Action will now publish to NPM! 🚀'"
1515
},
1616
"engines": {

src/datasource.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import { InMemoryLRUCache } from '@apollo/utils.keyvaluecache'
44
import { createCachingMethods } from './cache'
55
import { isCollectionOrModel, isModel } from './helpers'
66

7-
87
class MongoDataSource {
9-
constructor({modelOrCollection, cache}) {
8+
constructor({ modelOrCollection, cache }) {
109
if (!isCollectionOrModel(modelOrCollection)) {
1110
throw new GraphQLError(
1211
'MongoDataSource constructor must be given a collection or Mongoose model'

0 commit comments

Comments
 (0)