Mongo DB

41 readers
3 users here now

founded 2 years ago
MODERATORS
1
 
 

Adds the sort operator, which supports sorting in ascending or descending order on fields that you define in your Atlas Search index for sorting.

Limits the knnBeta operator as a top-level operator.

Introduces the ability to perform text, wildcard, regular expression, fuzzy, and range searches on string fields by using the queryString operator.

2
 
 

I get this is a long shot but hey, lets make some content.

I am trying to search (via mongodb commands) inside fields that contain the following example JSON content:

Each 'Details' field uses the same structure inside the collection:

[
    {
        "references": [
            "https://www.owasp.org/index.php/SQL_Injection",
            "https://cwe.mitre.org/data/definitions/89.html"
        ],
        "locale": "en",
        "title": "SQL injection is possible",
        "vulnType": "Web Application",
        "description": "<p>SQL injection (or SQLi)....</p>",
        "observation": "<p>The following endpoint and subsequent data extraction was found to be vulnerable to SQL injection:</p><p></p>",
        "remediation": "<p>The most effective way to prevent SQL....</p></li></ul>",
        "customFields": [
            {
                "customField": "631816bfcef08a001188c9d5",
                "text": "A03:2021-Injection"
            },
            {
                "customField": "631855d0cef08a001188ca0c",
                "text": ""
            },
            {
                "customField": "63198741cef08a001188ca38",
                "text": ""
            },
            {
                "customField": "638d3ff17406ad001120d10d",
                "text": "C3: Secure Database Access"
            },
            {
                "customField": "639680ce7406ad001120d196",
                "text": "Implementation"
            }
        ]
    }
]

I have tried assorted commands such as:

db.vulnerabilities.find({Details: {$regex: 'Web Application'}}
db.vulnerabilities.find({ Details: { $in: ["vulnType"]}})
db.vulnerabilities.find({ "details" : /vulnType/ }

These are shots in the dark clearly but I cant see an obvious way to look for specific strings or even json pairs. Any help would be appreciated.