ArangoDB-Community / arangodb-net-standard

A consistent, comprehensive, minimal interface to enable .NET applications to use the complete range of features exposed by the ArangoDB REST API.
Apache License 2.0
76 stars 30 forks source link

Filter on Guid #492

Closed bar10dr closed 5 months ago

bar10dr commented 5 months ago

I'm trying to filter on a Guid property, but I get the following error

syntax error, unexpected identifier near 'f41722e-4261-4b21-ad12-6ddc9c5b9...' at position 2:35 (while parsing)

        public async Task<LogItem?> GetLog(Guid Id)
        {
            var response = await _arangoClient.Cursor.PostCursorAsync<LogItem>(
                @$"FOR doc IN {_collectionName} 
                FILTER doc.Id == {Id}
                RETURN doc"
            );

            return response.Result.SingleOrDefault();
        }

How do I accomplish this?

bar10dr commented 5 months ago

Figured it out

public async Task<LogItem?> GetLog(Guid Id)
{
    var response = await _arangoClient.Cursor.PostCursorAsync<LogItem>(
        @$"FOR doc IN {_collectionName} 
        FILTER doc.Id == ""{Id}""
        RETURN doc"
    );

    return response.Result.SingleOrDefault();
}