ObjRelationPojo Table a record

public class YpObjRelationPojo implements Serializable {
@Id
private String id; // ' Primary key id'
@Field("sourceid")
private String sourceId; // object id
@Field("targetid")
private String targetId; // object id
@Field("caseId")
private String caseId; // case id
@Transient // Configure transparent properties
private int source; // ' Starting point of relationship No database
@Transient
private int target; // ' The end of the relationship No database
@Transient
private String color;
@Transient
private String relation; // ' Relationship name '
@Field("relation_type")
@DBRef
private YpRelationTypePojo relation_type;
@Field("create_time")
private Date create_Time; // ' Creation time '

omitted set,get Method

@DBRef Used to associate objects

{
"_id" : ObjectId("54a24e8a25600d768a4e13ac"),
"sourceid" : "54a20a6dd9d886078991aa98",
"targetid" : "54a209dfd9d886078991aa95",
"caseId" : "100",
"relation_type" : {
"$ref" : "relationtype",
"$id" : ObjectId("54a21b0ad9d886078991aa9e")
}
}

If you need to find out in this record relation_type, View the associated objects

We need to use the point notation

Id by relation_type The record of the table id

ObjectId objectId = new ObjectId(Id);

Query query1=Query.query(Criteria.where("relation_type.$id").is(objectId));

List<YpObjRelationPojo> r=mongoTemplate.find(query1, YpObjRelationPojo.class, "YpObjRelationPojo");

After finding out , Delete this field

Update update=new Update();

update.unset("relation_type");

Mongodb Cascade delete query operation more related articles

  1. python database -mongoDB Advanced query operations for (55)

    One .MongoDB Indexes Why index ? Suppose there is a Book , What do you want to see in Chapter 6, section 6 , What would you do , The average person must go to the catalogue , Find the number of pages in this section , Then turn to this page . This is the catalog index , Help readers quickly find the chapters they want . ...

  2. iOS CoreData The cascade deletion and other operations

    About CoreData There are some Chinese materials on the Internet , But most of these materials are not involved CoreData Detailed operation of , Just a simple demonstration of the most basic usage . The most basic database operations like cascade deletion are not mentioned . I saw some English on the Internet today ...

  3. MongoDB Fuzzy query operation of ( Class relational database like and not like)

    1. Function and grammatical description effect :  Regular expressions use a specified string to describe . Matches a series of strings that conform to a syntax rule . Many programming languages support string manipulation with regular expressions .MongoDB Use  $regex  Operator to set the match ...

  4. Xamarin.Android Introductory example (4) The realization of SQLLite Add / modify / Delete / Query operation

    1.Main.axml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns: ...

  5. Chapter one : One day learn MongoDB Database Python operation

    This article is just about learning to use , from :https://www.cnblogs.com/suoning/p/6759367.html#3682005 There is a new one in it Python Add, delete, modify and check the code What is? MongoD ...

  6. MongoDB API and python operation

    install download mongodb Version of , Two points attention According to industry rules , Even numbers are stable , Such as 1.6.X, The odd number is the development version , Such as 1.7.X 32bit Of mongodb It can only store 2G The data of ,64bit There is no limit To the official website , Choose the right ...

  7. mongodb_ Query operation use _ Conditions of the query 、where Clause, etc ( turn )

    <?php /*  mongodb_ Query operation use _ Conditions of the query .where Clause, etc ( Transfer and learn )   1.find()/findOne() mongodb The query operation of the database is to use find() perhaps findO ...

  8. spring mongodb Add, delete, change and check operation

    Add data School @Id @GeneratedValue private long id; @Indexed(unique = true) private String name; studen ...

  9. 【JPA Cascade save / cascading deletion 】@OneToMany ( two-way ) One to many 【 turn 】

    [http://blog.sina.com.cn/s/blog_625d79410101dbdd.html]    Read the first two help documents  [JPA] @OneToOne A one-way   and  [JPA]@OneToO ...

Random recommendation

  1. from IClassFactory by CLSID by {00024500-0000-0000-C000-000000000046} Of COM Component failed to create instance , The reason is the following error : 8001010a terms of settlement

    1. Enter... On the command line :dcomcnfg, The “ Component service ” Manager 2. open “ Component service -> Computer -> My computer ->DCOM To configure ”, find “Microsoft Word file ”, Right click , choose ...

  2. Adjacency table undirected graph ( One ) And C Language explanation

    This chapter introduces the adjacency table undirected graph . stay " The theoretical basis of graph " The theory of graph has been introduced in , The concept of graph is not repeated here . As usual , This article will first give C The realization of language : We will give you the following C++ and Java Implementation of version ...

  3. java The use of common keywords

    Super keyword : The reference space to the parent object . effect :1. When a member variable with the same name exists in a subclass and a parent class , Can pass super To call the member variables of the parent class . 2.super Can be used to call the construction method of the parent class . Instanceof Turn off ...

  4. Oracle Redo Log Mechanism Summary ( Reprint )

    Oracle Of Redo Mechanism DB An important mechanism of , Understanding this mechanism is important for DBA It's also very important , Previous Blog Li also wrote some scattered , I read Lao Bai's diary a few days ago , So combined with the contents of Lao Bai's diary , Yes oracle Of ...

  5. MySql practice + Add source code

    One . There's a database , It includes four tables : Student list (Student). The curriculum (Course). League tables (Score) And teacher information sheet (Teacher). The structure of the four tables is shown in table 1-1 Table of ( One )~ surface ( Four ) Shown , The data is shown in the table 1 ...

  6. php Common configuration (php.ini)

    see php The location of the configuration file # /usr/local/php/bin/php -i | head php The comments in the configuration file use ; Number 1.disable_functions(php Functions to disable ) phpin ...

  7. FlashBack-SCN-TIMESTAMP

    One . Based on time (as of timestamp) Of flashback1. Create table create table flash_tab(id,vl) as select rownum,oname from ( se ...

  8. ES--08

    71. The secret of the kernel principle _ Finally, optimize the write process to achieve massive disk file consolidation (segment merge,optimize) Syllabus One per second segment file, Too many documents , And every time search Search all of them seg ...

  9. Centos 7 Upgrade the kernel

    Check current CentOS System kernel version uname -sr stay CentOS 7 Enable on ELRepo Warehouse rpm --import https://www.elrepo.org/RPM-GPG-KE ...

  10. 【VB6】 Global keyboard hook

    There's basically nothing to say , Do not use Trojans and malicious programs in the past from VB.NET The program changed to VB6 Of , Castration has some functions , Keyboard only Hook If you want to intercept hotkeys, you can return them in the handler 1, There are examples Download address  http://pan.b ...