lundi 26 juin 2017

MongoDb Laravel where clause

In MongoDb i have documents with a field named "common_id". I just want to fetch all documents of a particular common_id.

This is how the common_id field looks like.

"common_id" : ObjectId("5911af8209ed4456d069b1d1"),

I have tried this,

$bestAmongAffiliates = MasterAffiliateProductMappingMongo::where('common_id', '=', 'true')
->get();

this,

$bestAmongAffiliates = MasterAffiliateProductMappingMongo::where('common_id', '=', 'ObjectId("5911af8209ed4456d069b1d1")')
->get();

and this,

MasterAffiliateProductMappingMongo::where('common_id', '=', ObjectId("5911af8209ed4456d069b1d1"))
    ->get();

But nothing works. How can i do this.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire