[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Handle-info] [Handle-MongoDB] New attributes?



If I remember correctly you have written a custom storage module to use MongoDB?  How to structure MongoDB queries will depend on how each handle or handle value is serialized into a MongoDB object.  In principle you could (and should!) certainly do that in such a way to allow access to the various components of the handle values in MongoDB queries.

The binary encoding of a handle value is specified in the Handle RFCs and this limits the ability to add new fields in a way compatible with the Handle protocol.  My strong recommendation would be to have the "data" of a handle value be a structured object---a bit of JSON, probably---which encodes the attributes you want.  You could even write your MongoDB storage module in such a way that it could notice when a handle value's data is JSON (perhaps for certain handle value "types") and "unpackage" it into a form compatible with MongoDB search.

Robert

On Jan 4, 2017, at 7:15 AM, Ruiz-Zafra, Angel <a.ruiz-zafra@ucl.ac.uk> wrote:

Hello!.

I'm using MongoDB as DBMS, instead BerkeleyDB.

My question is: It is possible add/support new attributes, besides the "static" ones (idx, timestamp, data, index, ttl, etc)?. With "support" I mean, manage any additional attribute like any other attribute through the Handle Storage, that is, when I use "HandleValue", get other additional attribute.

I've tried to define a custom class such as HandleValue (HandleValueMongo), with the same source code but adding HashMap<String,String> for other attributes, but couldn't be possible because some of attributes of HandleValue class are protected (only could be used by class of the same package).

I know that other option is connect directly with the DB, but I would like to do it through HandleStorage and HandleValue classes, I guess is more safety connect to the DB through Handle Server instead directly.

In the same way, it is possible to specify custom queries based on MongoDB to get information?. Like the "Custom sql statement" define in the chapter 7.1.4 of the documentation, but using MongoDB syntax to optimize the search.

Thanks in advance and best regards!


_______________________________________________
Handle-Info mailing list
Handle-Info@cnri.reston.va.us
http://www.handle.net/mailman/listinfo/handle-info

_______________________________________________
Handle-Info mailing list
Handle-Info@cnri.reston.va.us
http://www.handle.net/mailman/listinfo/handle-info