|
1 |
| -[](https://www.npmjs.com/package/apollo-datasource-mongodb) |
| 1 | +# Fork from [apollo-datasource-mongodb][1] |
2 | 2 |
|
3 |
| -Apollo [data source](https://www.apollographql.com/docs/apollo-server/data/fetching-data) for MongoDB |
| 3 | +This package is based on the PR created by @nnoce14 in GitHub |
| 4 | + |
| 5 | +Apollo [data source](https://www.apollographql.com/docs/apollo-server/data/fetching-data) for MongoDB |
4 | 6 |
|
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 | 7 |
|
8 | 8 | **Installation**
|
9 | 9 | ```
|
10 |
| -npm i apollo-datasource-mongodb |
| 10 | +npm i apollov4-datasource-mongodb |
11 | 11 | ```
|
12 | 12 |
|
13 | 13 | 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:
|
@@ -44,7 +44,7 @@ The basic setup is subclassing `MongoDataSource`, passing your collection or Mon
|
44 | 44 | `data-sources/Users.js`
|
45 | 45 |
|
46 | 46 | ```js
|
47 |
| -import { MongoDataSource } from 'apollo-datasource-mongodb' |
| 47 | +import { MongoDataSource } from 'apollov4-datasource-mongodb' |
48 | 48 |
|
49 | 49 | export default class Users extends MongoDataSource {
|
50 | 50 | getUser(userId) {
|
@@ -250,7 +250,7 @@ Since we are using a typed language, we want the provided methods to be correctl
|
250 | 250 | `data-sources/Users.ts`
|
251 | 251 |
|
252 | 252 | ```ts
|
253 |
| -import { MongoDataSource } from 'apollo-datasource-mongodb' |
| 253 | +import { MongoDataSource } from 'apollov4-datasource-mongodb' |
254 | 254 | import { ObjectId } from 'mongodb'
|
255 | 255 |
|
256 | 256 | interface UserDocument {
|
@@ -315,7 +315,7 @@ to your data source class and modifying to options argument of the constructor t
|
315 | 315 | assign the context to the member field on your data source class. Note: context needs to be a class in order to do this.
|
316 | 316 |
|
317 | 317 | ```ts
|
318 |
| -import { MongoDataSource } from 'apollo-datasource-mongodb' |
| 318 | +import { MongoDataSource } from 'apollov4-datasource-mongodb' |
319 | 319 | import { ObjectId } from 'mongodb'
|
320 | 320 |
|
321 | 321 | interface UserDocument {
|
|
0 commit comments