Skip to content

Commit

Permalink
Add examples to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
denis_savitsky committed Oct 8, 2023
1 parent 3f7535a commit d2755d2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ val q3 = query[Person](p => Pattern.matches("^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4

V Array Query Operators

1. $size

```scala
import oolong.dsl.*

Expand All @@ -204,6 +206,21 @@ val q = query[Course](_.studentNames.length == 20)
// q is {"studentNames": {"$size": 20}}
```

2. $elemMatch

```scala
import oolong.dsl.*

case class Course(studentNames: List[String], tutor: String)

val q = query[Course](_.studentNames.exists(_ == 20)) // $elemMatch ommited when querying single field
// q is {"studentNames": 20}

val q = query[Course](course => course.studentNames.exists(_ > 20) && course.tutor == "Pavlov")
// q is {"studentNames": {"$elemMatch": {"studentNames": {"$gt": 20}, "tutor": "Pavlov"}}}

```

#### Update operators

I Field Update Operators
Expand Down

0 comments on commit d2755d2

Please sign in to comment.