Skip to content

Commit

Permalink
Update package dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyarmes committed Jun 25, 2020
1 parent 6de9fe7 commit c9be5b3
Show file tree
Hide file tree
Showing 5 changed files with 2,095 additions and 986 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ import { createPipeline } from 'apongo';
...
const users = (_, { limit = 20 }, context, resolveInfo) => {
// Create a pipeline to first perform any initial matching, then do the lookups and finally the results
// Create a pipeline to first perform any initial matching, then do the lookups and finally fetch the results
const pipeline = [
// Perform any initial matching that you need.
// This would typically depend on the parameters passed to the query.
Expand Down Expand Up @@ -120,7 +120,7 @@ const users = (_, { limit = 20 }, context, resolveInfo) => {

This function will analyse the query and construct an aggregation pipeline to construct the lookups.

In the example above, the `users` query need to directly returns the result of an aggregation over the `Users` collection.
In the example above, the `users` query needs to directly returns the result of an aggregation over the `Users` collection.
If the GraphQL request includes the `company` field then Apongo will fetch data from the `Companies` collection using `$lookup`.


Expand Down Expand Up @@ -152,7 +152,7 @@ By default `createPipeline` assumes that the fields in current GraphQL request m
```

Here, the `paginatedUsers` resolver should return two fields, `count` and `users`. `users` needs be the result an aggregation
on the `Users` collection, sp we need to tell `createPipeline` this by passing the field name to `createPipeline`:
on the `Users` collection, so we need to tell `createPipeline` this by passing the field name to `createPipeline`:


```
Expand Down
9 changes: 0 additions & 9 deletions __tests__/apongo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import mongoUnit from 'mongo-unit';

import { apolloServer, User, Task } from './apollo-config';
import testData from './test-data';
import { chainResolvers } from 'graphql-tools';

const TASKS = gql`
query {
Expand Down Expand Up @@ -36,23 +35,15 @@ const PAGINATED_TASKS = gql`
const query = apolloServer();

beforeAll((done) => {
console.info(
`Starting mongoUnit...
Note that the tests need to download mongodb-prebuilt the first time, and that can take a few minutes.
If you get an error concerning spawning, run 'chmod -R u+x node_modules/mongodb-prebuilt/' and try again.`
);

return mongoUnit.start()
.then(() => {
console.log('Fake mongo is started');
mongoose.connect(mongoUnit.getUrl(), { useNewUrlParser: true, useUnifiedTopology: true });
mongoUnit.load(testData)
done();
})
}, 1200000);

afterAll(() => {
console.log('Stopping mongoUnit...')
mongoose.disconnect();
return mongoUnit.stop();
});
Expand Down
Loading

0 comments on commit c9be5b3

Please sign in to comment.