[Enginio] How query object with regular expression



  • Hello,

    I want to query object list stored in my users collection with a regular expression. In the documentation, it's not explain.

    My exemple is written in Node.js language:
    @app.get('/api/users', function(req, res)
    {
    debugRequest(req);
    authenticateRequest(req, function(e, session)
    {
    if(!e)
    {
    var data = req.body;
    users.find(
    {
    "login": "Cha.*" // Doesn't work
    }, function(err, userItems)
    {
    // error; should not happen
    if(err)
    {
    res.json(err);
    return;
    }

                    // successful; return json
                    res.json(cleanJson(userItems));
                });
            } else
            {
                res.json(error(403, "Access Denied!"));
            }
        });
    });@
    

    And the *users *json ojects in Enginio are:
    @{
    "email": "chasou@test.com",
    "password": "////////////",
    "login": "Chasou",
    "name": "Charlotte Mars"
    }
    {
    "email": "chase@test.com",
    "password": "////////////",
    "login": "Chase",
    "name": "Chase Mars"
    }
    @

    I read the Full text search documentation but I don't understand how use it in my Node.js code.

    Thank you for your help.



  • I have tested the Full text search on my EDS instance with a curl command like in the example "here":https://developer.qtcloudservices.com/eds/key-concepts/full-text-search.

    @curl -XGET -H "Enginio-Backend-Id: XXXXXXXX" --data-urlencode 'search={"phrase": "Cha*"}&objectTypes=objects.users' https://api.engin.io/v1/search@

    And I have this error:

    @{"errors":[{"reason":"InvalidParameter","message":"objectTypes parameter is required"}]}@

    Okay, perhaps that my command or the example doesn't work then I implemented the search in my Node.Js code and I have unfortunately the same error.

    It's a EDS error ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.