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

Add a reference to another document in MongoDB C# MongoDB.Driver

I have two classes: public class MDBProducts { public string _id { get; set; } public string order_number { get; set; } [BsonIgnoreIfNull] public List partsId { get; set; } } public class…
0
votes
0 answers

Use $in for id field on embedded DBRef object in mongodb

I want to use $in for id field of inner DBRef object and do in such a way: {users: {$elemMatch: {device: {'$ref': 'devices', '$id' : { "$in" : [ 'deviceId' ] }}}}} In response I get nothing(but I should). If I query on exact id it works ok:…
Vlad Hanzha
  • 464
  • 3
  • 11
0
votes
1 answer

Using DBRef in mongo go driver

I want to use DBref with go-mongo-driver but I couldn't find any example about it. How can I achieve this? I worked with Spring Data Mongodb before and you can indicate Dbref inside a class like : @DBRef private EmailAddress emailAddress; Is…
akinKaplanoglu
  • 728
  • 2
  • 8
  • 26
0
votes
1 answer

Mongo Document with DBRef

There are many example how work with mongo document Creating BSON object from JSON string And other But I can not find how to create a document with a link (DBRef) to another Something like this private static final MessageFormat USER_DBREF = new…
LeshaRB
  • 1,345
  • 2
  • 23
  • 44
0
votes
0 answers

Resolve Mongo DBRef with Java driver

I use Mongo DBRef with Java driver, but the Mongo client returns a DBRef object instead of a Map object. Document doc = new Document(); doc.append("projectName", "New project"); doc.append("owner", new DBRef("users",…
hadf
  • 279
  • 2
  • 5
  • 15
0
votes
1 answer

com.mongodb.DBRef cannot be cast to org.bson.Document

Hello i'm trying to retrive the roles of user witch are based on another document, I have the referens of this roles in the user document as a list of objects i get a mistake when this is excuted List listRoles = (List)…
hamou amroun
  • 1
  • 1
  • 2
0
votes
1 answer

Hibernate OGM MongoDB DBRef support

Does Hibernate OGM support MongoDB DBRefs? If no, how this support may be added? I guess Hibernate should provide any extension mechanism like custom type mapper, converters or something like that. Thanks! PS. Please, be constructive and don't write…
S2201
  • 1,339
  • 3
  • 18
  • 35
0
votes
1 answer

Spring Data - Mongo DB - @TextIndexed over @DBRef

Is it possible somehow to search in String fields over @DBRef. I have this @Document: public class DocumentFileVersion { @TextIndexed @DBRef private OtherObject otherObject and I will search in String fields of otherObject. Is there…
quma
  • 5,233
  • 26
  • 80
  • 146
0
votes
1 answer

MongoDB+Spring: Query Get Object without @DBRef referenceObjects

I am trying to query object without nested reference using Spring and mongo DB. For instance @Document public class A { @Id private String id; private String data; @DBRef private B b; } @Document public class B { @Id …
Juan Caicedo
  • 1,425
  • 18
  • 31
0
votes
1 answer

Spring MongoDB + QueryDSL query by @DBRef related list

@Document(collection="users") public class User{ @Id private int id; private String name; ... //getters-setters } @Document(collection="models") public class Model{ @Id private int id; private String name; @DBRef private…
Dreampie
  • 1,321
  • 4
  • 17
  • 32
0
votes
1 answer

Spring with MongoRepository: DBRef

I'm trying to use the dbref function from spring. My Code: @EnableAutoConfiguration @RestController @RequestMapping("/poi") public class PoiBasicController { @Autowired private PoiRepository poiRepository; @RequestMapping(value =…
0
votes
2 answers

Spring AbstractMongoEventListener does not trigger

Context: Java8 application, Spring MongoDB 1.9.1 I've got a collection containing entities of A, and another collection containing entities of B. In my domain model, Entity A has a collection of B as DBRef like this class A { @DBRef List
Jan B.
  • 6,030
  • 5
  • 32
  • 53
0
votes
1 answer

How to show data from 2 collections in Mongodb with DBRef

I have two main collections in my MongoDB, users & address. I am using '$ref' and '$id' in my 1st collection (users) to refer to documents of the 2nd collection (address). I want to write a query to show details of the user and his addresses. This…
0
votes
1 answer

DBref in MongoDB

I'm trying to make queries with MongoDB but i have a questions. Query and structure: How do I view information about the author at that job with this query? (for example I want to see the name of the autor with the information of the job)
sigLosco
  • 101
  • 3
  • 5
  • 10
0
votes
1 answer

Dereference a ReferenceField in Mongoengine

I am trying to dereference a reference field on my Flask backend and return the complete object with that certain field dereferenced. The field I am trying to dereference is defined like this: vouches_received =…
Yarneo
  • 2,922
  • 22
  • 30