Mongoid 5.0 support for $ lookup

Does anyone know if version 5.0 of Mongolian stones supports $ 5.0 lookup ?

Nothing is mentioned mongoid docs .

+4
source share
1 answer

You can convert the mongo shell query to search into a mongoid query like this. It hurt me to figure it out. So send here if this helps someone.

clookup =     {
'$lookup': {
    'from': "contacts",
    'localField': "_id",
    'foreignField': "account_id",
    'as': "contacts"
    }
}

sort = { '$sort': { '_id.year': 1, '_id.month': 1 } }

docs = Account.collection.aggregate([clookup, sort])
pp docs.first
+1
source

Source: https://habr.com/ru/post/1623469/


All Articles