mercredi 19 mai 2021

Using aggregate query how can I get ids of existing record ( rails mongodb )

I have a bunch of video records and I want to find out the video ids of this record.

I had try collect, pluck and distinct as well but it's tacking to much time for execute. so I want to use aggregate query. but I don't know how to write this query. If any one knows please help me out.

videos = Video.all
video_ids = videos.pluck(:id)

Thanks :)

Aucun commentaire:

Enregistrer un commentaire