英文:
Is there an alternative to org.bson.types.ObjectId that doesn't require the entire mongodb driver?
问题
只是为了背景,出于依赖原因,我必须从项目中移除 MongoDB(请勿对 MongoDB 不敬!)。我已经在将所有部件替换为 PostgreSQL 等效部件方面进展良好,但我在 org.bson.types.ObjectId
部分遇到了一些困难 - 出于一致性的原因,我不想完全替换它们,但我又不愿意仅为此保留整个 org.mongodb:mongo-java-driver:3.12.5
依赖。
是否有其他方法来生成等效的 ObjectIDs?或者是否可以单独导入 bson 类型呢?
英文:
So just for background I have to drop mongodb from a project (for dependency reasons, no disrespect to MongoDB!). I'm well into replacing all of the pieces with PostgreSQL equivalents but I'm a little bit stuck on org.bson.types.ObjectId
- I don't want to replace those completely, for consistency reasons but I'm loathe to keep the whole org.mongodb:mongo-java-driver:3.12.5
dependency in my project just for that.
Is there some other way to generate equivalent ObjectIDs? Or can I import just the bson types separately somehow?
答案1
得分: 1
> 有其他方法可以生成等效的ObjectIDs吗?
您可以自己实现ObjectId规范,它相当简单。
英文:
> Is there some other way to generate equivalent ObjectIDs?
You can implement the ObjectId spec yourself, it is pretty small.
答案2
得分: 0
这似乎有效(gradle):
compile group: 'org.mongodb', name: 'bson', version: '3.12.5'
英文:
This seems to work (gradle):
compile group: 'org.mongodb', name: 'bson', version: '3.12.5'
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论