Hi I am looking for solution. I am not sure if this question is already here in stackoverflow. I was trying to find its solution on google but couldn't find any solution. I need to fetch records from mongo database such that it should be ordered by the array of ids I specify only. For example following is the set of data from the required table.
{ "_id" : NumberLong("5832686213760"), "created_by" : "3694181860160", "title" : "adsf", "date" : "2015-10-12 21:57:27", "cat" : "251", "description" : "dsafadsf", "members" : [ "3694181860160" ], "battles" : [ ], "is_deleted" : NumberLong(0) }
{ "_id" : NumberLong("5836854817600"), "created_by" : "3692778550272", "title" : "dd", "date" : "2015-10-13 02:13:32", "cat" : "939", "description" : "dddd", "members" : [ "3692778550272", "3690476217152" ], "battles" : [ "1475499726016" ], "is_deleted" : NumberLong(0) }
{ "_id" : NumberLong("5830033945536"), "created_by" : "3692705624256", "title" : "My own group", "date" : "2015-10-11 11:50:27", "cat" : "731", "description" : "yes this is my own group. hahahhahah", "members" : [ "3692705624256" ], "battles" : [ "1478264481792", "1472313521152", "1478428020992" ], "is_deleted" : NumberLong(0) }
If I need to fetch the above data in the order as following array specify.
array("5830033945536","5832686213760", "5836854817600")
Please note that this is only a part of data and ids, the real query will be dynamic. I am working in Yii 1.x. So I need the solution in json as well as in php.