mfenniak / rethinkdb-net

A C# / .NET client driver for RethinkDB.
Other
247 stars 37 forks source link

Nested Lists #244

Closed erik-kle closed 8 years ago

erik-kle commented 8 years ago

Hi, Im trying to recreate the following query in rethinkdb-net but can´t get it to work. Can someone help me out?

r.db("db").table("tablex").filter(function(participants) { return participants("Participants").contains(function(user) { return user("UserId").eq("255d8253-e3f0-4158-a75e-c67be7e232c0") }) })

mfenniak commented 8 years ago

Hi Erik,

It would map to this in rethinkdb-net:

Query.Db("db")
    .Table<TableX>("tablex")
    .Filter(participants =>
        participants.Participants.Contains(user =>
            user.UserId == "255d8253-e3f0-4158-a75e-c67be7e232c0"))

But before you get to this point, you'd need to define a data type for TableX, which contains a Participants field that is an enumerable (array or list) of some type (User?), and the User type needs to have a UserId field that is a string. If any of those details are different, you'd have to adjust the query above.