{"id":45601867,"url":"https://github.com/emfjson/emfjson-mongo","last_synced_at":"2026-02-23T14:40:51.413Z","repository":{"id":21408167,"uuid":"24726154","full_name":"emfjson/emfjson-mongo","owner":"emfjson","description":"MongoDB adapter for EMF","archived":false,"fork":false,"pushed_at":"2017-08-30T08:16:12.000Z","size":72,"stargazers_count":9,"open_issues_count":3,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-01-14T18:26:47.578Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emfjson.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":"2014-10-02T16:06:52.000Z","updated_at":"2022-07-25T17:48:29.000Z","dependencies_parsed_at":"2022-08-21T10:11:05.562Z","dependency_job_id":null,"html_url":"https://github.com/emfjson/emfjson-mongo","commit_stats":null,"previous_names":["ghillairet/mongo-emfjson","ghillairet/emfjson-mongo"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/emfjson/emfjson-mongo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emfjson%2Femfjson-mongo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emfjson%2Femfjson-mongo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emfjson%2Femfjson-mongo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emfjson%2Femfjson-mongo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emfjson","download_url":"https://codeload.github.com/emfjson/emfjson-mongo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emfjson%2Femfjson-mongo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29745913,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T07:44:07.782Z","status":"ssl_error","status_checked_at":"2026-02-23T07:44:07.432Z","response_time":90,"last_error":"SSL_read: 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":"2026-02-23T14:40:51.301Z","updated_at":"2026-02-23T14:40:51.403Z","avatar_url":"https://github.com/emfjson.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MongoDB Adapter for Eclipse Modeling Framework (EMF)\n\n[![Build Status](https://secure.travis-ci.org/emfjson/emfjson-mongo.png)](http://travis-ci.org/emfjson/emfjson-mongo)\n\nAn easy to use adapter that works on top of the EMF Resource API to store and retrieve EMF Models on MongoDB.\n\n### Download\n\nAdd the following dependency to your pom file.\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.emfjson\u003c/groupId\u003e\n    \u003cartifactId\u003eemfjson-mongo\u003c/artifactId\u003e\n    \u003cversion\u003e0.3.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nYou can also find the jars in [maven central](http://search.maven.org/#search|ga|1|emfjson-mongo)\n\n### Usage\n\nSetup the ResourceSet:\n\n```java\nResourceSet resourceSet = new ResourceSetImpl();\n\nresourceSet.getPackageRegistry().put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE);\nresourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(\"*\", new JsonResourceFactory());\nresourceSet.getURIConverter().getURIHandlers().add(0, new MongoHandler());\n```\n\nCreate a Resource with a URI pointing to MongoDB. The URI must contains 3 segments identifying the database, the collection and the document id.\n\nThe URI should have the form ```mongodb://{host}[:{port}]/{db}/{collection}/{id}```\n\n```java\nURI uri = URI.createURI(\"mongodb://localhost:27017/emfjson-test/models/model1\");\nResource resource = resourceSet.createResource(uri);\n```\n\nAlternatively, you can use a URI mapping:\n\n```java\nresourceSet.getURIConverter().getURIMap().put(\n\tURI.createURI(\"http://resources/\"), \n\tURI.createURI(\"mongodb://localhost:27017/emfjson-test/models/\"));\n\t\nResource resource = resourceSet.createResource(URI.createURI(\"http://resources/model1\"));\n```\n\nOverride the name of the field to avoid problem with the reserved name of Bson. And set the uri handler, to avoid problem with external resources.\n\n```java\n\tHashMap\u003cString, Object\u003e DEFAULT_OPTIONS = new HashMap\u003cString, Object\u003e();\n\tDEFAULT_OPTIONS.put(EMFJs.OPTION_URI_HANDLER, new IdentityURIHandler());\n\tDEFAULT_OPTIONS.put(EMFJs.OPTION_REF_FIELD, \"_ref\");\n\tresourceSet.getLoadOptions().putAll(DEFAULT_OPTIONS);\n```\n\nSaving documents\n\n```java\nEPackage p = EcoreFactory.eINSTANCE.createEPackage();\np.setName(\"p\");\n\nEClass c = EcoreFactory.eINSTANCE.createEClass();\nc.setName(\"A\");\n\np.getEClassifiers().add(c);\n\nresource.getContents().add(p);\nresource.save(null);\n```\n\nLoading document\n\n```java\nresource.load(null);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femfjson%2Femfjson-mongo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femfjson%2Femfjson-mongo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femfjson%2Femfjson-mongo/lists"}