Query for subdocument, "type" type ---- 4:arry

Issue #30 open
luochenxi
created an issue

Hi all, I want to replace pymongo with monary in my code. I have to extract a part of the document from the mongodb collection (the fields that contain all the array lists), I tried to use the "type" type, but the result is that the query is an array of [4], and I need to get the value of the array field and then reduce it to a Dimension array. Is it possible that monary does not support it? I can't find a way to do this.

  • I have a DB,"deepnet_hash",with "hash_hot"(documents):
{ 
    "mvid" : "1021776415",
    "video_code" : [ 41, 147, 108, 9, 136, 1, 32, 96, 32, 112, 43, 128, 32, 0, 6, 128 ], 
    "video_label" : 7, 
    "create_time" : 1530965658.600823
}
  • mycode:
with Monary(host='127.0.0.1',port=3005) as monary:
    arrays = monary.query(
        "deepnet_hash",                         # database name
        "hash_hot",                             # collection name
        {"video_label":7},                      # query spec
        ["mvid","video_code","create_time"],      # field names (in Mongo record)
        ["string:20","type","float64"]             # Monary field types (see below)
    )
  • result:
arrays== [masked_array(data=[1021776415, --, --, ..., --, --, --],
             mask=[ False,  True,  True, ...,  True,  True,  True],
       fill_value='N/A',
            dtype='|S20'), masked_array(data=[4, 4, 4, ..., 4, 4, 4],
             mask=[False, False, False, ..., False, False, False],
       fill_value=999999,
            dtype=uint8), masked_array(data=[1530965658.599762, 1530965658.599822,
                   1530965658.599878, ..., 1531126323.057035,
                   1531126323.057063, 1531126323.057069],
             mask=[False, False, False, ..., False, False, False],
       fill_value=1e+20)]
  • problem

    How do I get the value of "video_code ==[ 41, 147, 108, 9, 136, 1, 32, 96, 32, 112, 43, 128, 32, 0, 6, 128 ]" instead of " data=[4, 4, 4, ..., 4, 4, 4] " ?

Comments (5)

  1. luochenxi reporter

    How do I get the value of "video_code ==[ 41, 147, 108, 9, 136, 1, 32, 96, 32, 112, 43, 128, 32, 0, 6, 128 ]" instead of " data=[4, 4, 4, ..., 4, 4, 4] " Next, Catenate arrays of values into one array.

  2. Log in to comment