How can I search for a property if I do not know its name?

0

In my database mongodb I am saving a document with the following structure:

{
    "_id": "A/B",
    "Properties": {
        "Abandoned": {
            "TypeName": "int",
            "Name": "A/B/Abandoned",
            "Value": 2
        },
        "Busy": {
            "TypeName": "byte[]",
            "Name": "A/B/Busy",
            "Value": "<bynarydata>"
        }
    }
}

The properties do not have a known name and so I can not browse them, ie I can not use Properties.Abandoned (for example)

I would like to get all properties whose TypeName is not byte[] . Can you do that?

To clarify: In the document I gave as an example, I wanted to get only the Abandoned property.

    
asked by anonymous 18.10.2016 / 17:03

1 answer

0

It seems that I will solve the problem by putting the byte[] properties in a different zone of the document. That way I can do a simple projection to get only the non-binary properties. The document is structured as follows:

{
    "_id": "A/B",
    "Properties": {
        "Abandoned": {
            "TypeName": "int",
            "Name": "A/B/Abandoned",
            "Value": 2
        }
    },
    "ByteProperties": {
        "Busy" : {
            "TypeName": "byte[]",
            "Name": "A/B/Busy",
            "Value": "<bynarydata>"
        }
    }
}
    
19.10.2016 / 14:23