{"id":37119604,"url":"https://github.com/tinh-tinh/mongoose","last_synced_at":"2026-01-14T13:56:52.006Z","repository":{"id":257201430,"uuid":"852327836","full_name":"tinh-tinh/mongoose","owner":"tinh-tinh","description":"🍃 Mongo ODM module for Tinh Tinh framework","archived":false,"fork":false,"pushed_at":"2026-01-13T15:31:13.000Z","size":113,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-13T16:29:22.786Z","etag":null,"topics":["framework","golang","mongodb"],"latest_commit_sha":null,"homepage":"","language":"Go","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/tinh-tinh.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-09-04T16:06:31.000Z","updated_at":"2026-01-13T15:04:27.000Z","dependencies_parsed_at":"2024-11-14T02:30:55.793Z","dependency_job_id":"2b9d292b-b5f2-493b-b385-ed5ff15770e1","html_url":"https://github.com/tinh-tinh/mongoose","commit_stats":null,"previous_names":["tinh-tinh/mongoose"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/tinh-tinh/mongoose","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinh-tinh%2Fmongoose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinh-tinh%2Fmongoose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinh-tinh%2Fmongoose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinh-tinh%2Fmongoose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tinh-tinh","download_url":"https://codeload.github.com/tinh-tinh/mongoose/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinh-tinh%2Fmongoose/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28422378,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T13:30:50.153Z","status":"ssl_error","status_checked_at":"2026-01-14T13:29:08.907Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["framework","golang","mongodb"],"created_at":"2026-01-14T13:56:51.358Z","updated_at":"2026-01-14T13:56:51.994Z","avatar_url":"https://github.com/tinh-tinh.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mongoose for Tinh Tinh\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg alt=\"GitHub Release\" src=\"https://img.shields.io/github/v/release/tinh-tinh/mongoose\"\u003e\n\u003cimg alt=\"GitHub License\" src=\"https://img.shields.io/github/license/tinh-tinh/mongoose\"\u003e\n\u003ca href=\"https://codecov.io/gh/tinh-tinh/mongoose\" \u003e \n \u003cimg src=\"https://codecov.io/gh/tinh-tinh/mongoose/branch/master/graph/badge.svg?token=EP4XOF5HOY\"/\u003e \n\u003c/a\u003e\n\u003ca href=\"https://pkg.go.dev/github.com/tinh-tinh/mongoose\"\u003e\u003cimg src=\"https://pkg.go.dev/badge/github.com/tinh-tinh/mongoose.svg\" alt=\"Go Reference\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"https://avatars.githubusercontent.com/u/178628733?s=400\u0026u=2a8230486a43595a03a6f9f204e54a0046ce0cc4\u0026v=4\" width=\"200\" alt=\"Tinh Tinh Logo\"\u003e\n\u003c/div\u003e\n\n## Overview\n\nMongoose for Tinh Tinh is a powerful MongoDB integration package designed specifically for the Tinh Tinh framework. It provides a clean, efficient, and type-safe way to work with MongoDB databases in your Go applications.\n\n## Features\n\n- 🚀 Simple and intuitive MongoDB integration\n- 📦 BSON document handling\n- 🔄 Automatic model serialization/deserialization\n- 🎯 Type-safe query building\n- 🛠️ Advanced features including:\n  - Collection operations\n  - Aggregation pipelines\n  - Index management\n  - Transaction support\n  - Change streams\n  - GridFS support\n\n## Installation\n\nTo install the package, use:\n\n```bash\ngo get -u github.com/tinh-tinh/mongoose/v2\n```\n\n## Quick Start\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"github.com/tinh-tinh/mongoose/v2\"\n)\n\n// User represents your MongoDB document\ntype User struct {\n    ID       string `bson:\"_id,omitempty\"`\n    Name     string `bson:\"name\"`\n    Email    string `bson:\"email\"`\n    Age      int    `bson:\"age\"`\n    IsActive bool   `bson:\"is_active\"`\n}\n\nfunc main() {\n    // Initialize MongoDB connection\n    client := mongoose.New(\u0026mongoose.Config{\n        URI:      \"mongodb://localhost:27017\",\n        Database: \"myapp\",\n    })\n\n    // Get a collection\n    collection := client.Collection(\"users\")\n\n    // Insert a document\n    user := User{\n        Name:     \"John Doe\",\n        Email:    \"john@example.com\",\n        Age:      30,\n        IsActive: true,\n    }\n    \n    result, err := collection.InsertOne(context.Background(), user)\n    if err != nil {\n        panic(err)\n    }\n}\n```\n\n## Configuration\n\nThe package supports various configuration options:\n\n```go\ntype Config struct {\n    URI              string        // MongoDB connection URI\n    Database         string        // Database name\n    MaxPoolSize      uint64        // Maximum number of connections\n    MinPoolSize      uint64        // Minimum number of connections\n    ConnectTimeout   time.Duration // Connection timeout\n    MaxConnIdleTime  time.Duration // Maximum idle connection time\n    RetryWrites     bool          // Enable retry writes\n    RetryReads      bool          // Enable retry reads\n    DirectConnection bool          // Use direct connection\n}\n```\n\n## Key Features\n\n### Collection Operations\n```go\n// Find documents\nusers, err := collection.Find(ctx, bson.M{\"age\": bson.M{\"$gt\": 25}})\n\n// Update documents\nupdate := bson.M{\"$set\": bson.M{\"is_active\": false}}\nresult, err := collection.UpdateMany(ctx, bson.M{\"age\": bson.M{\"$lt\": 18}}, update)\n\n// Delete documents\nresult, err := collection.DeleteOne(ctx, bson.M{\"email\": \"john@example.com\"})\n```\n\n### Aggregation Pipeline\n```go\npipeline := mongo.Pipeline{\n    {{$match: {\"age\": {\"$gt\": 25}}}},\n    {{$group: {\"_id\": \"$city\", \"count\": {\"$sum\": 1}}}}\n}\ncursor, err := collection.Aggregate(ctx, pipeline)\n```\n\n### Transactions\n```go\nerr := client.UseTransaction(ctx, func(sessCtx mongo.SessionContext) error {\n    // Perform operations within transaction\n    _, err := collection.InsertOne(sessCtx, newUser)\n    if err != nil {\n        return err\n    }\n    _, err = collection.UpdateOne(sessCtx, filter, update)\n    return err\n})\n```\n\n## Best Practices\n\n1. **Connection Management**\n   - Always close connections when done\n   - Use appropriate pool sizes\n   - Handle connection errors properly\n\n2. **Error Handling**\n   - Check for both operation and connection errors\n   - Implement proper retry logic\n   - Log relevant error information\n\n3. **Performance Optimization**\n   - Use appropriate indexes\n   - Implement efficient queries\n   - Monitor query performance\n\n## Documentation\n\nFor detailed documentation and examples, please visit:\n- [Go Package Documentation](https://pkg.go.dev/github.com/tinh-tinh/mongoose)\n- [MongoDB Go Driver Documentation](https://docs.mongodb.com/drivers/go)\n\n## Contributing\n\nWe welcome contributions! Here's how you can help:\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## Support\n\nIf you encounter any issues or need help, you can:\n- Open an issue in the GitHub repository\n- Check our documentation\n- Join our community discussions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinh-tinh%2Fmongoose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftinh-tinh%2Fmongoose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinh-tinh%2Fmongoose/lists"}