visit
It can be used directly from the frontend as it supports authorization via your
jwt
, it also can be composed with other services using Apollo Federation
(so for example you can handle the mutations in a different service).Let's create an example, a basic blog app with 2 collections: users and postsschema: |
type User {
_id: ObjectId
username: String
email: String
}
type BlogPost {
_id: ObjectId
author_id: ObjectId
title: String
content: String
}
types:
User:
collection: users
BlogPost:
collection: posts
relations:
- field: posts
from: User
to: BlogPost
relation_type: to_many
where:
author_id: ${{ parent['_id'] }}
# docker-compose.yml
version: '3'
services:
mongoke:
ports:
- 4000:80
image: mongoke/mongoke
environment:
DB_URL: mongodb://mongo/db
volumes:
- ./mongoke.yml:/conf.yml
mongo:
image: mongo
logging:
driver: none
{
user(where: {username: {eq: "Mike"}}) {
_id
username
email
posts {
nodes {
title
}
}
}
blogPosts(first: 10, after: "Post 1", cursorField: title) {
nodes {
title
content
}
pageInfo {
endCursor
hasNextPage
}
}
}