d0si / vortex

Vortex framework project. Fast, extensible and easy to use backend framework
https://vortex.d0.si
MIT License
3 stars 1 forks source link

[FEATURE] Create simple query interface #45

Closed ZigaBobnar closed 4 years ago

ZigaBobnar commented 4 years ago
ZigaBobnar commented 4 years ago

Create/insert/add data into collection/table in database: void simple_insert(string database, string collection, string json_value)

Find/search/query all matching entries: string simple_find_all(string database, string collection, string json_simple_query) Find first matching entry: string simple_find_first(string database, string collection, string json_simple_query)

Replace first matching entry: void simple_replace_first(string database, string collection, string json_simple_query, string replacement_json_value)

Delete all matching entries: void simple_delete_all(string database, string collection, string json_simple_query) Delete first matching entry: void simple_delete_first(string database, string collection, string json_simple_query)

ZigaBobnar commented 4 years ago

Simple query (uses syntax similar to that of MongoDB but there is currently no filtering - the query will be directly passed to the client in case of MongoDB):

{
    // field_1 == "value_1"
    "field_1": "value_1",

    // field_2 == "value_2" || field_2 == "value_4"
    "$or": [
        { "field_2": "value_2" },
        { "field_2": "value_4" }
    ]

    // field_3 == "value_3" && field_4 == "value_4"
    "field_3": "value_3",
    "field_4": "value_4"
}