include one attribute of other collection in mongoid rails Query

I want to query with mongoid , I have following models

class Score
   include Mongoid::Document
   field :value, :type => Integer
   belongs_to :user

class User
   include Mongoid::Document
   field :name, :type => String
   field :age, :type => Integer
   has_many :scores

I want to query all the scores from collection with their users. but users object should have only have the 'name' field in it

I would be something like


Please tell the correct syntax for this


Score references User, so it is not possible to retrieve them both in one query, because there are no joins in MongoDB.

Either denormalize and include user name in Score or do several queries.

Need Your Help

Spring Batch. Call methods with rollbackFor

java jpa transactions spring-batch

In some batch job, i call a method from a class, that's marked with:

How do i add this sharing button? IOS8 with swift

iphone swift ios8 sharing ios-extensions

I want there to be a button in my app, that when it is pressed, this(See image below) Pops up. How do i do that? I don't want to create a custom sharing extion, i just want the default one? What co...