Print

Print


i am more familiar to PERL, but your code examples will help a lot,

thank you



________________________________
 Απο: Jon Stroop <[log in to unmask]>
Προς: [log in to unmask] 
Στάλθηκε: 5:26 μ.μ. Παρασκευή, 5 Ιουλίου 2013
Θέμα: Re: [CODE4LIB] MARC record model to be inserted in mongodb
 

Have you seen Ross' post: http://dilettantes.code4lib.org/blog/2010/09/a-proposal-to-serialize-marc-in-json/ ?

pymarc can get you this json, e.g.:

```
records = pymrx.parse_xml_to_array('/path/to/some/marc.xml')

json_file = [record.as_json() for record in records]

```

or, for that matter, if you happen to be using Mongo's Python API, you /may/ be able to call `as_dict()` when you store the record:

```
my_mongo_collection.insert(record.as_dict())
```

It looks like ruby-marc does something similar, and presumably the Mongo API for Ruby uses Ruby hashes the way that the Python API uses dicts, so a similar approach is probably possible in Ruby.

As for "...an efficient way so as to get results with the appropriate queries." I guess that all depends on what you're trying to do.

-Jon

-- Jon Stroop
Digital Initiatives Programmer/Analyst
Princeton University Library
[log in to unmask]



On 07/05/2013 05:47 AM, dasos ili wrote:
> Could you please give us any suggestions on a data model example regarding a MARC record? The goal is to be able to store it in mongodb, in an efficient way so as to get results with the appropriate queries.
> 
> thank you in advance
>