{"id":13480711,"url":"https://github.com/mongojack/mongojack","last_synced_at":"2026-04-02T01:28:51.870Z","repository":{"id":7377876,"uuid":"8705029","full_name":"mongojack/mongojack","owner":"mongojack","description":"Mongojack maps Java objects to MongoDB documents. Based on the Jackson JSON mapper, Mongojack allows you to easily handle your mongo objects as POJOs (insert, search by id or by any other field, update).","archived":false,"fork":false,"pushed_at":"2026-03-16T00:26:04.000Z","size":10632,"stargazers_count":274,"open_issues_count":57,"forks_count":112,"subscribers_count":36,"default_branch":"master","last_synced_at":"2026-03-16T11:34:51.034Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://mongojack.org","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mongojack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2013-03-11T14:22:00.000Z","updated_at":"2026-01-31T05:27:35.000Z","dependencies_parsed_at":"2024-01-05T23:57:30.465Z","dependency_job_id":"ad5fa66a-7b9c-4f25-bb69-086c5e3a1e85","html_url":"https://github.com/mongojack/mongojack","commit_stats":{"total_commits":544,"total_committers":65,"mean_commits":8.36923076923077,"dds":0.8161764705882353,"last_synced_commit":"10202d0245749847b384c675b6311f689e11f73a"},"previous_names":["devbliss/mongojack"],"tags_count":74,"template":false,"template_full_name":null,"purl":"pkg:github/mongojack/mongojack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongojack%2Fmongojack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongojack%2Fmongojack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongojack%2Fmongojack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongojack%2Fmongojack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mongojack","download_url":"https://codeload.github.com/mongojack/mongojack/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongojack%2Fmongojack/sbom","scorecard":{"id":336873,"data":{"date":"2025-08-11","repo":{"name":"github.com/mongojack/mongojack","commit":"a7dff09f34667b5bd3f05e08c5831a7f76364d71"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4,"checks":[{"name":"Maintained","score":5,"reason":"7 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 2/25 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":3,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'master'","Info: 'force pushes' disabled on branch 'master'","Info: 'branch protection settings apply to administrators' is required to merge on branch 'master'","Warn: could not determine whether codeowners review is allowed","Warn: no status checks found to merge onto branch 'master'","Warn: PRs are not required to make changes on branch 'master'; or we don't have data to detect it.If you think it might be the latter, make sure to run Scorecard with a PAT or use Repo Rules (that are always public) instead of Branch Protection settings"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 7 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T04:56:07.730Z","repository_id":7377876,"created_at":"2025-08-18T04:56:07.730Z","updated_at":"2025-08-18T04:56:07.730Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31293895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T01:05:07.454Z","status":"ssl_error","status_checked_at":"2026-04-02T00:56:46.496Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":[],"created_at":"2024-07-31T17:00:44.057Z","updated_at":"2026-04-02T01:28:51.861Z","avatar_url":"https://github.com/mongojack.png","language":"Java","funding_links":[],"categories":["Libraries"],"sub_categories":["Java"],"readme":"Mapping to POJOs couldn't be easier!\n====================================\n\nSince MongoDB uses BSON, a binary form of JSON, to store its documents, a JSON mapper is a perfect mechanism for mapping Java objects to MongoDB documents.  And the best Java JSON mapper is Jackson. \nJackson's parsing/generating interface fits serialising to MongoDBs documents like a glove.  Its plugins, custom creators, serialisers, views, pluggable annotators and so on give this mapping library\na massive head start, making it powerful, performant, and robust.\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.mongojack/mongojack/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.mongojack/mongojack)\n\nSnapshots, when appropriate, are available in Sonatype's snapshot repositories.\n\n5.x Updates\n-----------\n\nIn the 5.x update, deprecated objects (Aggregation, DBProjection, DBQuery, DBSort, DBUpdate) have been removed\nin favor of native mongo java driver constructs.  This is a work in progress.  For examples of how to replace\nthe deprecated constructs, check out the tests as they differ between 4.x and 5.x versions.\n\nAlso note that this moves the minimum supported JVM to 11.  Though it _should_ work up to 21.\n\nSome \"gotchas\" and issues:\n- Using `Updates` doesn't provide custom mapping, so if you have a custom serializer on a field in the object\n  on which the collection is based, that won't take effect, and you will have to do the custom mapping yourself.\n\nThis attempts to support MqlValues.  See some documentation (in the context of aggregation) [here](https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/aggregation-expression-operations/).\n\nEx from that documentation:\n```java\nimport static com.mongodb.client.model.Aggregates.*;\nimport static com.mongodb.client.model.Accumulators.*;\nimport static com.mongodb.client.model.Projections.*;\nimport static com.mongodb.client.model.Filters.*;\nimport static com.mongodb.client.model.mql.MqlValues.*;\n\nclass Foo {\n    public void doSomething() {\n        coll.aggregate(\n            List.of(\n                match(expr(\n                    current()\n                        .getArray(\"visitDates\")\n                        .size()\n                        .gt(of(0))\n                        .and(current()\n                            .getString(\"state\")\n                            .eq(of(\"New Mexico\")))\n                )),\n                group(current().getString(\"string\"), min(\"integer\", current().getInteger(\"integer\")))\n            ),\n            MockObjectAggregationResult.class\n        );\n    }\n}\n```\n\nProject documentation\n---------------------\n\nThe official documentation for this project lives [here](http://mongojack.org).\n\nMailing lists\n-------------\n\nThe MongoDB Jackson Mapper users mailing list is hosted [here](http://groups.google.com/group/mongo-jackson-mapper).\n\nIssues\n------\n\nThe MongoDB Jackson Mapper issues are hosted [here](https://github.com/mongojack/mongojack/issues).\n\nQuick start\n-----------\n\n### Mongo driver compatibility\n\n- Version 2.3.0 and earlier are compatible only with the 2.x series mongo-java-driver.\n- Version 2.5.0 to 2.10.0 are compatible with the 3.x series mongodb-driver using the legacy 3.x series APIs.\n- Version 3.0.0 and later are compatible with versions 3.12.x and later of the mongo driver using mongodb-driver-sync without the legacy APIs.\n- Version 4.N.x+, 5.N.x are compatible with the _matching_ `mongodb-java-sync` driver, although patch versions are not kept in sync \n\n### Installation\n\n#### Using a Java dependency manager\n\nThe quickest and easiest way to start using MongoJack is to use one of the standard Java build tools, such as Maven or Gradle.  For example:\n\nMaven:\n```xml\n    \u003cdependency\u003e\n      \u003cgroupId\u003eorg.mongojack\u003c/groupId\u003e\n      \u003cartifactId\u003emongojack\u003c/artifactId\u003e\n      \u003cversion\u003e5.1.0\u003c/version\u003e\n    \u003c/dependency\u003e\n```\n\nGradle:\n```groovy\n    implementation 'org.mongojack:mongojack:5.1.0'\n```\nor\n```kotlin\n    implementation(\"org.mongojack:mongojack:5.1.0\")\n```\n\n### Writing code\n\n*Note*: The 3.0 release of MongoJack removes all the functions of the older JacksonDBCollection, and all references to the legacy Mongo APIs.\n\nMongoJack now supports _only_ usage of the java mongo driver's 3.x API.  There are two ways to use this feature.\n\n1) Use the JacksonCodecRegistry class\n2) Use the JacksonMongoCollection class\n\nFor a more detailed look at migration from 2.x to 3.x, see [the migration guide](MIGRATING.md)\n\n### Using JacksonCodecRegistry\nThe java mongo 3.0 and higher driver supports the usage of codecs to map to specific types. MongoJack provides a Codec Registry which can be used for this purpose. Some example code making use of the JacksonCodecRegistry can be seen below:\n    \n    MongoClient mongo = new MongoClient();\n    MongoDatabase mongoDatabase = mongo.getDatabase(testDatabaseName);\n    JacksonCodecRegistry jacksonCodecRegistry = new JacksonCodecRegistry();\n    jacksonCodecRegistry.addCodecForClass(MyObject.class);\n    MongoCollection\u003c?\u003e coll = mongoDatabase.getCollection(\"testCollection\");\n    MongoCollection\u003cMyObject\u003e collection = coll.withDocumentClass(MyObject.class).withCodecRegistry(jacksonCodecRegistry);\n\nThe first two lines above get the database using the mongo driver. The third line constructs a new JacksonCodecRegistry. The fourth line tells the JacksonCodecRegistry to create a codec that will use Jackson for serialization/deserialization for the class MyObject. The fifth line gets a MongoCollection from the MongoDatabase, and the sixth tells the MongoCollection to use  the MyObject class and work with the JacksonCodecRegsitry setup on lines three and four. JacksonCodecRegistry includes the default Mongo codecs, so it will also be capable of serializing and deserializing the Document and other default classes.\n\n### Using JacksonMongoCollection\n\nJacksonMongoCollection is an implementation of MongoCollection which builds a JacksonCodecRegistry for you and adds some additional features such as mapping of queries and update documents.  As an implementation\nof MongoCollection, it has all the features of the underlying driver, including map-reduce functionality, aggregation, transactions, etc.  To use a JacksonMongoCollection the user will first need to initialize it using the builder.\n\n    MongoClient mongo = new MongoClient();\n    JacksonMongoCollection\u003cMyObject\u003e collection = JacksonMongoCollection.builder()\n        .withObjectMapper(customObjectMapper)\n        .build(mongo, \"testDatabase\", \"testCollection\", MyObject.class);\n    \nThe builder allows you to specify the collection in a number of different ways; see the code and JavaDoc for specific options.\n\nUsage largely follow the same pattern as the JacksonDBCollection with a few exceptions.  In general, you use a JacksonMongoCollection as if it were a MongoCollection; it implements all methods and\ndelegates almost everything to an underlying collection.  The collection provides some additional helper methods, but in generally the interface is the same as `com.mongodb.client.MongoCollection`. \n\nOld JacksonMongoCollection:\n    \n    MockObject o1 = new MockObject(\"1\", \"ten\", 10);\n    MockObject o2 = new MockObject(\"2\", \"ten\", 10);\n    coll.insert(o1, o2, new MockObject(\"twenty\", 20));\n    List\u003cMockObject\u003e results = collection.find(new BasicDBObject(\"string\", \"ten\")).toArray();\n\nNew:\n\n    MockObject o1 = new MockObject(\"1\", \"ten\", 10);\n    MockObject o2 = new MockObject(\"2\", \"ten\", 10);\n    coll.insertMany(Arrays.asList(o1, o2, new MockObject(\"twenty\", 20)));\n    List\u003cMockObject\u003e results = collection.find(Filters.eq(\"string\", \"ten\")).into(new ArrayList\u003c\u003e());\n \nThe biggest difference between the usage of `JacksonDBCollection` and `JacksonMongoCollection` is that is that most of the inputs to the methods in the API must implement the `org.bson.conversions.Bson` interface.  This\nallows you to pass instances of `org.bson.Document`, or `com.mongodb.BasicDBObject`, or any of Mongo's helper/builder objects like `com.mongodb.client.model.Filters`, `com.mongodb.client.model.Aggregates`,\nor `com.mongodb.client.model.Updates`.\n\nMongoJack's older DBQuery, Updates, and Aggregation helpers should all still work with the new JacksonMongoCollection, but they have been deprecated as the Mongo driver provides a set of useful builders\nfor all of these things in the `com.mongodb.client.model` package.  The implementation attempts to do mapping on any `Bson` inputs.\n\n### Using a custom ObjectMapper\n\nIf you want to use a custom ObjectMapper, you need to install MongoJackModule on\nyour ObjectMapper before using it.  This can be done with one of two mechanisms.  The first one installs\nthe MongoJackModule, and also installs JavaTimeModule and changes some other settings on the object mapper.\n\n    ObjectMapper customObjectMapper = new ObjectMapper()\n    // ... configure your object mapper\n    ObjectMapperConfigurer.configureObjectMapper(customObjectMapper)\n    // ...\n    MongoClient mongo = new MongoClient();\n    JacksonMongoCollection\u003cMyObject\u003e collection = JacksonMongoCollection.builder()\n        .withObjectMapper(customObjectMapper)\n        .build(mongo, \"testDatabase\", \"testCollection\", MyObject.class);\n\nIf you want to install _only_ the module itself, you can use the following, which installs the module\nbut makes no other changes:\n\n\n    ObjectMapper customObjectMapper = new ObjectMapper()\n    // ... configure your object mapper\n    ObjectMapperConfigurer.addMongojackModuleOnly(customObjectMapper)\n    // ...\n    MongoClient mongo = new MongoClient();\n    JacksonMongoCollection\u003cMyObject\u003e collection = JacksonMongoCollection.builder()\n        .withObjectMapper(customObjectMapper)\n        .build(mongo, \"testDatabase\", \"testCollection\", MyObject.class);\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongojack%2Fmongojack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmongojack%2Fmongojack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongojack%2Fmongojack/lists"}