2013/7/4 Bernat Romagosa <tibabenfortlapala...@gmail.com>:
> For other kinds of matches, you need javascript queries, if I understood:
>
> User selectOne: [ :each | each where: 'this.name[0] == "s"' ]
>
> Right?

Just as a side note.

Beware of the "$where" filter (it is: { "$where": this.that == 's' }),
it deserializes the BSON for every value, converts it to the
JavaScript object and then performs the comparison, it is not
efficient in any way.

There are lots of ways to perform the query using built-in operators
instead of $where. (*)

(*) Disclaimer: None of it is pretty in any way. Actually they're
ugly. It's like specifiying an SQL WHERE statement with dictionaries,
or worst, an Excel formula with Dictionaries.

Having some sort of "intelligence" from the Smalltalk side converting
comparison operators to their MongoDB counterparts is really useful.

Regards,

Reply via email to