-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code examples for link querying/updates #7
Comments
@RandyGuck Ok, so I was able to set up linking (link one entity to another) by using I was hoping |
Hi Sumanyu. Sorry for the delayed reply, but I was heads-down getting some new client features checked-in that you might be interested in. Check out the HelloDory app in the doradus-client project for an example that uses the new "Dory" client, which supports the builder pattern for constructing schema and object updates. DBObject.removeFieldValues() is indeed the method that should remove existing values from an MV scalar or link field. For links, be sure to use the raw, unencoded object IDs you want to remove. If you're still having trouble, perhaps send me a code snippet that I can look at. I'll also do some checking from my side. BTW, values can also be removed using the new DBObject.Builder methods removeFieldValues(). |
Given an object with ID "SOME_PARENT_ID" and another object with ID "SOME_CHILD_ID" already in Doradus and linked, the following code example in scala should unlink the object:
|
Hi Sumanyu. I need to learn Scala some day, but your code looks correct. However, you need to place the DBObject in a DBObjectBatch and post it with an "add batch" command. Here's the Java code using the com.dell.doradus.client.Client: SpiderSession session = (SpiderSession)Client.openApplication("HelloSpider", "localhost", 1123, null, null);
DBObject dbObj = new DBObject("Spidy1", "Movies");
dbObj.removeFieldValues("Leads", Arrays.asList("KDunst"));
DBObjectBatch batch = new DBObjectBatch();
batch.addObject(dbObj);
BatchResult result = session.addBatch("Movies", batch); Because an object with ID "Spidy1" object already exists, the DBObject becomes an "update" (instead of an "add"), so the existing object is updated. In this case, "KDunst" is removed from the link "Leads". |
So spider session has a nice method called
@RandyGuck, can you confirm unlinking works on release 2.3? Also, when are you doing the next release? |
I just tried the removeFieldValues() example above using a 2.3 client and server and it works. Our next release is v2.4: the code is checked into the master branch and is fairly stable. There are many new features--I'm putting together documentation for this release now and should have it posted within a week or so. We're also restructuring the wiki pages and documentation, so you should be seeing those updates within a week or two as well. |
I read the docs on links and MV fields, but I'm not sure how to use doradus session (java client) to either link one object to another or query for example: "Find me all people whose manager is Bob". Code examples would be wonderful.
The text was updated successfully, but these errors were encountered: