Skip to content

Fix Search Schema for Names and Services #169

@Ruxuan

Description

@Ruxuan

The following search

db.getCollection('searches').find({"_id": ObjectId("5d13fa822b27ff07fe91f28d")})

returns the json below. The names and services objects are double nested in an array.

{
    "_id" : ObjectId("5d13fa822b27ff07fe91f28d"),
    "names" : [ 
        [ 
            {
                "value" : "CRYSTAL WYMENGA",
                "label" : "CRYSTAL WYMENGA",
                "First" : "CRYSTAL",
                "Last" : "WYMENGA"
            }
        ], 
        [ 
            {
                "value" : "LAURIE WISEMAN",
                "label" : "LAURIE WISEMAN",
                "First" : "LAURIE",
                "Last" : "WISEMAN"
            }
        ], 
        [ 
            {
                "value" : "NORMA WILLIAMS",
                "label" : "NORMA WILLIAMS",
                "First" : "NORMA",
                "Last" : "WILLIAMS"
            }
        ]
    ],
    "services" : [ 
        [ 
            {
                "value" : "ACS-MAIN",
                "label" : "ACS-MAIN"
            }
        ], 
        [ 
            {
                "value" : "ABA-ABA",
                "label" : "ABA-ABA"
            }
        ], 
        [ 
            {
                "value" : "BLV-MAIN",
                "label" : "BLV-MAIN"
            }
        ]
    ],
    "location" : {
        "value" : "Any",
        "label" : "Any"
    },
    "time" : {
        "value" : 30,
        "label" : "30 mins"
    },
    "numSessions" : {
        "value" : 1,
        "label" : "1"
    },
    "timeOfDay" : {
        "value" : "anytime",
        "label" : "Anytime"
    },
    "__v" : 0
}

The names field should be in the following format,

"names" : [
            {
                "value" : "CRYSTAL WYMENGA",
                ...
            },
            {
                "value" : "LAURIE WISEMAN",
                ...
            },
            {
                "value" : "NORMA WILLIAMS",
                ...
            }
]

Similarly for the services field.
Screenshot 2019-06-26 19.08.57.png

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions