Jason Cheek
Posts: 0
Joined: Sun Jan 12, 2014 8:00 am

Query on object field sub-property

How do I construct the where clause to filter based on the properties inside an object field? For example, say I have a field "name" which stores an object like {"first": "xxx", "last": "xxx"}.

How can I search for all people whose name starts with "J"? (Jason, Jon, Jeffrey...)

This doesn't seem to be working:

where: {
name: {
first: {
$regex: "J"
}
}
}

Jason Cheek
Posts: 0
Joined: Sun Jan 12, 2014 8:00 am

Query on object field sub-property

Oh, I found it.

where: {
"name.first": { $regex: "J" }
}

obullei
Posts: 0
Joined: Thu Jun 05, 2014 12:17 am

Query on object field sub-property

Hello!

We are happy to hear this update from you.

Return to “Issues”