HashMaps with subdocuments

17 views
Skip to first unread message

alexmnyc

unread,
Sep 17, 2013, 12:04:41 AM9/17/13
to rogue...@googlegroups.com
Hi guys,

I'm trying to see how one would approach a query like this

db['user.users'].find({"followers.5237afe68c9a759a8d056e7a": {$exists:true}},{"followers.5237afe68c9a759a8d056e7a":1})

"followers" is BsonRecordMapField based on the implementation noted here http://stackoverflow.com/questions/9396275/define-a-mongorecord-in-lift-with-a-map-inside-it

I'm attempting to implement Mongo white paper's social networking use case (3) https://jira.mongodb.org/secure/attachment/16610/MongoDB-use-cases.pdf from page 17

As you'll see, followers is a HashMap.

Also, on stackoverflow, "at" operator seems to be provided with the solution but I cannot seem to figure out how to use its syntax.

Any help and insight is greatly appreciated as usually. Thank you.

Jason Liszka

unread,
Sep 17, 2013, 12:57:03 PM9/17/13
to rogue...@googlegroups.com
If you include the code from the stackoverflow answer, and import ExtendRogue._, you should be able to do

Users.where(_.followers at "5237afe68c9a759a8d056e7a" exists true).select(_.followers at "5237afe68c9a759a8d056e7a").fetch()


--
You received this message because you are subscribed to the Google Groups "rogue-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rogue-users...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
Message has been deleted
0 new messages