Questions tagged [dbref]

mongodb - Database references

DBRefs (MongoDB) are references from one document to another using the value of the first document’s _id field, collection name, and, optionally, its database name. By including these names, DBRefs allow documents located in multiple collections to be more easily linked with documents from a single collection. (Database references[MongoDB])

117 questions
0
votes
1 answer

referencing a MongoDB collection using @DBRef annotation inside a list of custom object(DTO) but refence value coming as null

I have a model class AssessmentTemplate which is like this. public class AssessmentTemplate { @Field("_id") @Id private String assessmentId; private Date creationDate; private String type; private String status; @Field("coreQuestions") private…
0
votes
1 answer

How to acess dbRef.$id and dbRef.$ref in mongosh?

Using MongoDB: 6.0.4 Using Mongosh: 1.4.1 I inserted a book and a publisher (dbRef) with mongosh. # insert publisher publisher_id = ObjectId() db.publishers.insert_one({ '_id': publisher_id, 'title': 'XXX', 'website':…
Marv
  • 33
  • 3
0
votes
1 answer

Storing/Saving only a particular object from list of objects along with parent object in MongoDB

In mongodb, I have a master table called category sample data as below: { "_id" : "63d3e01f43aa4e0ee349f841", "subCategories" : [ { "subCategoryId" : NumberLong(1), "name": "Mobile phones" }, …
jarvo69
  • 7,908
  • 2
  • 18
  • 28
0
votes
0 answers

Problem When embedding JSON Object inside another object by DBRef

I wrote the code to try DBRef Concept: The Students Collections has: { "FirstName": "Omar", "LastName": "Ali", "IsFired": true, "FacultyID": { "$ref": "Faculty", "$id": "633d5fca2bed487dd7eb4e11", "$db":…
IBdr
  • 1
  • 2
0
votes
1 answer

how should migrate my DBRef fields with mongock?

I have a problem with migrating an entity which has DBRef fields. If I change any field in this entity, my DBRefs are gone. What should I do? Query query = new Query(); List criteriaList = new ArrayList(); …
mukara
  • 9
  • 3
0
votes
1 answer

DBRef resolution is not supported

I can't find what I'm doing wrong. What I want is to make a reference from the account class to the vehicles @Document(collection = "cuentas") public class CuentaDTO { @Id @NonNull private String cuentaId =…
0
votes
1 answer

MongoDB - DBRef to a DBObject

Using Java ... not that it matters. Having a problem and maybe it is just a design issue. I assign "_id" field to all of my documents, even embedded ones. I have a parent document ( and the collection for those ) which has an embedded document So I…
Robert
  • 368
  • 2
  • 8
0
votes
1 answer

Spring boot Dbref

I am new to spring boot and having trouble resolving dbref. On a spring boot project I am using MongoDB with dbref. I want to create two collections prescription and medicines. Prescription has a list of Medicines. @Document public class…
Devas
  • 28
  • 7
0
votes
1 answer

Flask-PyMongo DBRef is not working as expected

How can I define ref and how to query a collection with ref populating related fields. I defined a ref when inserting a product document in a product collection, but when querying I am getting info as inserted without populating the category field.…
Valentine Sean
  • 79
  • 3
  • 13
0
votes
1 answer

Get Embed Document based on DBRef in MongoDB using Spring data

I'm developing a spring boot application. I've 2 models that is PersonEntity @Data @Document(collection = "products") public class ProductEntity implements Serializable { private static final long serialVersionUID = -8118791879505582652L; …
Ravi S.
  • 68
  • 1
  • 17
0
votes
1 answer

How to unpack nested DBRef in Python?

How do you unpack nested DBRefs? I have checked the mongodb documentation but I still do not quite understand how to unpack the alphanumeric value within the brackets. d = { "oId" : 567, "notice" : [ DBRef("noticeId",…
jcoke
  • 1,555
  • 1
  • 13
  • 27
0
votes
1 answer

Spring Mongodb aggregation doesn't work with DBRef

I have an aggregation which doesn't work in mongodb and spring boot. I would be grateful if anyone could help me. Here is my ExplainDoc class: @Document(collection = "ExplainDoc") public class ExplainDoc{ @Id private String id; …
user1419243
  • 1,655
  • 3
  • 19
  • 33
0
votes
1 answer

A problem about manipulating DBRef data during anlyzing mongodb data through python

I'm working with MongoDB and want to analyze the extracted data from this database by python to visualize required information.Two question arises: 1) in such data there is DBRef that I don't know how to manipulate it, 2) it seems that is a nested…
0
votes
1 answer

How to deal with a two-way @DBref in Spring Data?

I have a Bike model: public class Bike { @Id private ObjectId objectId; @DBRef private Brand brand; private String model; } and a Brand model: public class Brand { @Id private ObjectId objectId; private String…
Sebastian M
  • 471
  • 1
  • 4
  • 20
0
votes
0 answers

@DBRef with MongoTemplate and non-reactive MongoClient

I am using Spring MVC 5.2.6 to create a simple reservation system. I noticed that in my case (I do not need much scalability) a usage of @DBRef with mongodb is a good solution. However I am facing a very weird issue.…
user1415536
  • 236
  • 1
  • 14
  • 26