Realm-js: Document how to use $0 in filters

Created on 4 Apr 2016  路  5Comments  路  Source: realm/realm-js

How do I filter by a date?

I am trying:

.filtered(`workoutDate = "${workoutDate}"`)

and

.filtered(`workoutDate = ${workoutDate.getTime()}`)

but I get You must pass in a date argument to compare

T-Doc

Most helpful comment

This worked:

.filtered('workoutDate = $0', workoutDate)};

All 5 comments

This worked:

.filtered('workoutDate = $0', workoutDate)};

Can someone add an example with $0 to the official docs?

This really needs to be added to the official docs.

It's random that I noticed this comment on a closed issue :-). It's better to create a new issue next time. But I will rephrase the title and reopen. Thanks for reporting this anyway though! :-)

An example exists in https://realm.io/docs/javascript/latest/#queries (search for '$0').

Was this page helpful?
0 / 5 - 0 ratings