蒙古包
mongoke的Python项目详细描述
特点
- 功能强大的查询:分页、过滤、关系、中继式连接内置在几秒钟内生成
- 与现有数据库一起工作:将其指向一个现有的MongoDb数据库,立即获得一个随时可以使用的graphqlapi
- Authorization via Jwt:可以基于Jwt负载和文档字段保护每个集合
- horizontal Scalable:该服务是完全无状态的,可以根据需要进行复制
- Apollo Federation:该服务可以很容易地与其他graphql服务器粘在一起,以处理写操作和更复杂的逻辑。在
- resility幂等元配置:一个YAML配置作为一个文件中真理、关系、授权和类型的唯一来源
快速启动:
使用Docker compose
尝试Mongoke最快的方法是通过docker compose。在
1。编写描述数据库模式和关系的配置
默认情况下,ObjectId标量已经定义,当作为json发送时,它将转换为字符串
# ./mongoke.yml schema: | 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'] }}
2。使用上述配置运行mongoke
映像
要启动容器装载副本,请将以下内容粘贴到docker-compose.yml
文件中,然后执行docker-compose up
。在
3。通过graphql查询生成的服务或转到http://localhost:4000/graphiql打开graphiql
{ User(where: { username: { eq: "Mike" } }) { _id username email posts { nodes { title } } } BlogPostNodes(first: 10, after: "Post 1", cursorField: title) { nodes { title content } pageInfo { endCursor hasNextPage } } }
教程
查看此repo中的/examples目录
请在这里发布并提交一个新的项目帮助列表!在
- 项目
标签: