{"id":15040592,"url":"https://github.com/devsu/condor-mongoose","last_synced_at":"2025-04-14T18:33:33.702Z","repository":{"id":57205266,"uuid":"80778802","full_name":"devsu/condor-mongoose","owner":"devsu","description":"Utils to work with mongoose and condor GRPC framework","archived":false,"fork":false,"pushed_at":"2017-06-06T16:30:54.000Z","size":75,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-13T08:26:07.769Z","etag":null,"topics":["condor-framework","crud","crud-generator","grpc","grpc-framework","mongodb","mongoose","nodejs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devsu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-02T23:24:48.000Z","updated_at":"2019-05-29T02:34:17.000Z","dependencies_parsed_at":"2022-09-12T22:50:37.068Z","dependency_job_id":null,"html_url":"https://github.com/devsu/condor-mongoose","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsu%2Fcondor-mongoose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsu%2Fcondor-mongoose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsu%2Fcondor-mongoose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsu%2Fcondor-mongoose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devsu","download_url":"https://codeload.github.com/devsu/condor-mongoose/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248937114,"owners_count":21186163,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["condor-framework","crud","crud-generator","grpc","grpc-framework","mongodb","mongoose","nodejs"],"created_at":"2024-09-24T20:44:46.692Z","updated_at":"2025-04-14T18:33:33.680Z","avatar_url":"https://github.com/devsu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# condor-mongoose\nThis module allows you to create CRUD services over GRPC in less than 5 minutes.\n\n[![Build Status](https://travis-ci.org/devsu/condor-mongoose.svg?branch=master)](https://travis-ci.org/devsu/condor-mongoose)\n[![Coverage Status](https://coveralls.io/repos/github/devsu/condor-mongoose/badge.svg?branch=master)](https://coveralls.io/github/devsu/condor-mongoose?branch=master)\n\n## How to use (Summary)\n\n- Just define your protos, and your mongoose models.\n- Setup your service using [condor-framework](https://github.com/devsu/condor-framework) and extending the `CrudBaseService` class.\n- Voilá, you have a working CRUD service over gRPC, connected to mongo (using mongoose).\n\n## Features\n\n- Automatic CRUD generation (list, insert, update, get, delete)\n- Supports subdocuments and related models\n- Allows queries (where, fields, limit, skip, sort)\n- Allows automatic population of related models (populate)\n\n## Installation\n```bash\nnpm i --save condor-framework mongoose condor-mongoose\n```\n\n## How to use\n1. Define the proto file.\n\n```proto\nsyntax = \"proto3\";\npackage bussiness;\n\nmessage Where {\n  string field = 1;\n  string value = 2;\n  Matcher matcher = 3;\n}\nmessage Sort {\n  string field = 1;\n  int32 value = 2;\n}\n\nenum Matcher {\n  STRING = 0;\n  REGEX = 1;\n  OBJECT = 2;\n}\n\nmessage QueryRequest {\n  repeated Where where = 1;   // empty =\u003e all\n  repeated string fields = 2; // empty =\u003e all\n  int32 limit = 3;            // 0 =\u003e unlimited\n  int32 skip = 4;             // 0 =\u003e none\n  repeated Sort sort = 5;\n}\n\nmessage PersonUpdate {\n  string id = 1;\n  repeated string fields = 2;\n  Person data = 3;\n}\n\nmessage Empty {}\n\nmessage IdRequest {\n  string id = 1;\n}\n\nmessage Person {\n  string id = 1;\n  string name = 2;\n  int32 age = 3;\n}\n\nservice PersonsService {\n  rpc List (QueryRequest) returns (Person) {}\n  rpc Insert (Person) returns (Person) {}\n  rpc Update (PersonUpdate) returns (Person) {}\n  rpc Get (IdRequest) returns (Person) {}\n  rpc Delete (IdRequest) returns (Empty) {}\n}\n```\n2. Create a service that extends from **CrudBaseService**.\n \n```js\nconst CrudBaseService = require('condor-mongoose');\nconst mongoose = require('mongoose');\n\nconst personSchema = {\n    'name': String,\n    'age': Number,\n};\n\nconst Person = mongoose.model('Person', new mongoose.Schema(personSchema));\n\nmodule.exports = class extends CrudBaseService {\n  constructor() {\n    super(Person);\n  }\n};\n```\n**Note:** **CrudBaseService** contains **base** methods (insert, update, delete, get, list), \n**sub documents** methods (push, addToSet, remove, update and replace) and **related models** \nmethods (push, addToSet, remove and replace).\n\n3. Initialize the service.\n```js\nconst mongoose = require('mongoose');\nconst Condor = require('condor-framework');\nconst Promise = require('bluebird');\nconst PersonService = require('./models/personService');\n\nmongoose.Promise = Promise;\nmongoose.connect('mongodb://localhost/business');\n\nconst protoPath = './bussiness.proto';\ncondor = new Condor()\n  .addService(protoPath, 'business.PersonService', new PersonService())\n  .start();\n```\n\n## License and Credits\n\nMIT License. Copyright 2017 *Devsu LLC*, a great [node development team](https://devsu.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevsu%2Fcondor-mongoose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevsu%2Fcondor-mongoose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevsu%2Fcondor-mongoose/lists"}