Questions tagged [jenssegers-mongodb]

A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)

An Eloquent model and Query builder with support for MongoDB, using the original Laravel API. This library extends the original Laravel classes, so it uses exactly the same methods.

GitHub Link

192 questions
0
votes
1 answer

Laravel MongoDB pass object in model

My current MongoDB schema is using a custom UUID object type as _id. I'm trying to generate a new UUID in my User model using $attributes = [];. I can't find any solution on how I can pass an object data type into my model. My model : use…
Simon Bolduc
  • 175
  • 10
0
votes
0 answers

Laravel mongoDB - jenssegers nested array update, convert query to run in Laravel

I am confused on finding a way to convert this mongo shell query to Laravel (using jenssegers). Here is the collection I have: test { "_id" : ObjectId("5d84b2b27ef856d9e55eef67"), "workflow" : [ { "basic_details" : { …
VishnuPrasad
  • 1,078
  • 5
  • 17
  • 36
0
votes
1 answer

Laravel MongoDB combining raw select count and group by

I am using jenssegers/laravel-mongodb I was wondering if I can do this with mongodb aggregate. I have a dataset of And I am trying to achieve this kind of result or anything close that I can loop into What I have right now is this: $collegeGender…
Kiel
  • 483
  • 3
  • 5
  • 18
0
votes
0 answers

Fetching Data from mongodb in Laravel

I have Documents in my mongoDB collection. I need to fetch the count of data associated to the perticular user according to the date. Date is in MongoDB\BSON\UTCDateTime Object. For ex. I need this week's data Im using jenssegers/mongodb packages…
0
votes
1 answer

Mongo lookup with condition

My project is using Laravel and jenssegers/laravel-mongodb ext. I have a query with lookup: '$lookup' => [ 'from' => 'proposals', 'localField' => '_id', 'foreignField' => 'proposal_round_mongo_id', 'as' => 'proposal' ] Proposal has…
Denys Siebov
  • 198
  • 4
  • 16
0
votes
1 answer

Following the steps to implement Laravel native mail verification bring to an issue

Following the guide to implement the native mail verification of laravel. Brings me an error. Note please that i use MongoDB, therefore i'm using Jensseger/laravel-mongodb package This is the error: Class App\User contains 3 abstract methods and…
0
votes
0 answers

Updating array field in document with another array

In Laravel 5 with MongoDB and jenssegers I'm trying to update an document's Array field. But it's not updating. When field contains Array[2] and I'm trying to update it with Array[1] it's not updating. In otherhand another document fields are…
0
votes
1 answer

Find documents with a certain field value only when another field value is a given string

I'm using this php package to make queries - https://github.com/jenssegers/laravel-mongodb The situation is, there are two fields, user_id and post_status among others. I want to retrieve all the documents in that collection, but when post_status…
0
votes
0 answers

MongoDB return array of values instead of json

I have a following document with json as value: . But mongodb returns array values instead. I am using jenssegers plugin for laravel. How can I get json value as it is from the table, instead of arrays. I tried json_encode() for this case, but…
Azima
  • 3,835
  • 15
  • 49
  • 95
0
votes
1 answer

Laravel and jenssegers mongodb relationship data not saving

I have 2 classes in Laravel class Company { public function people() { return $this->hasMany('Person'); } } class Person { public function company() { return $this->belongsTo('Company'); } } Now in another class, I am…
0
votes
1 answer

Loses the connection name when obtaining a record (Outside Laravel / enssegers/laravel-mongodb)

I need your help, I am using Eloquent and enssegers / laravel-mongodb outside Laravel Framework, I have managed to correctly configure both Eloquent and laravel-mongodb and it works correctly to insert and obtain results, however, when trying to…
0
votes
1 answer

How to check policy for each results when user requested for deleting multiple records in laravel?

I have a method bulk_destroy in the controller that accepts an array of ids that user wants to delete. I've to check for each record whether the user is the owner of that record or he has the specific role to delete that record. At the end I've to…
0
votes
1 answer

search and return objects in arrays mongoDB

I'm using laravel-mongoDB how can I search in attraction and blog titles and only retrieve the object, not whole record. I've tried [ '$match' => [ "attraction.title" => ['$regex' => '.*' . $request- >search . '.*'] …
Reza Sam
  • 1,264
  • 2
  • 14
  • 29
0
votes
1 answer

Laravel | jenssegers mongo DB. How to select from model with fields provided in $hidden?

I have a model User. There is a defined a hidden property. protected $hidden = [ 'password', 'remember_token', 'user_type', 'balance', 'reputation', 'country', 'region', 'dob', 'street', 'zipPostal' ]; Mostly all this fields…
Denys Siebov
  • 198
  • 4
  • 16
0
votes
1 answer

MongoDB aggregate + $match + $group + Condition filter

Here is my code : $profiles = Profile::raw()->aggregate([ [ '$unwind' => '$channels' ], [ '$match' => [ 'channels.sign_up' => true, ] …
Prafful Panwar
  • 439
  • 7
  • 19