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
3
votes
0 answers

How to create a new auto increase sequence number with a starting number in mongodb 2.6 and jensseger laravel?

is there any way to create a new sequence number from a default starting number using "findAndModify" in jenssegers laravel 5.1 and mongoDB 2.6 package or at-least in mongo 2.6? I have a counter collection and I am placing all my auto increment…
Kiran
  • 1,177
  • 4
  • 18
  • 35
3
votes
1 answer

How to implemet search query in subdocument of a collection in mongodb using jenssegers/laravel-mongodb library

I am using a jenssegers/laravel-mongodb library in a project. I have a collection in which a subdocument is created with other details. Now I have to implement a search query to search in the sub-document of the collection. The subdocument is…
Mukesh Joshi
  • 2,784
  • 4
  • 24
  • 34
3
votes
1 answer

Laravel Close mysql/mongodb connection

I am using laravel 5.1 with jenssengers mongodb. I am unusre if the connection to the mongodb & mysql is closed when not in use.if not what is the way i can close the connection.
Sameer Sheikh
  • 499
  • 1
  • 6
  • 16
3
votes
0 answers

Laravel MongoDB self reference

I made a Laravel 5 application with MongoDB. For MongoDB, I'm using jenssegers/laravel-mongodb. I have a MongoDB object like this: { "_id" : ObjectId("556c47677347b041b6004bfd"), "name" : "Lucht?", "type" : "onderzoeksvragen", …
Marten
  • 1,376
  • 5
  • 28
  • 49
2
votes
1 answer

MongoDB Laravel Jenssegers package: Undefined class constant 'PRIMARY' when inserting into DB

We are using Laravel 8.0, MongoDB 5.0 with driver version 1.16 and the Jenssegers package 3.8 which seem compatible together according to the manual presented in the following: https://github.com/jenssegers/laravel-mongod Our MongoDB configuration…
Mehran Alidoost Nia
  • 195
  • 2
  • 2
  • 11
2
votes
0 answers

Update of embedded model does not affect in related collection

What I get: My controller creates one intance of Message in the message collection. It contains an embedded instance of Image. It also creates a duplicate of the embedded Image in the images collection. After updating the name property of Image the…
2
votes
0 answers

Jensseger BelongsToMany returns nothing when selecting fields

I'm working with a Mongo database, and i have a Reading List with a BelongsToMany Relationship to a Stories table, it seems like this: public function stories() { return $this->belongsToMany(Story::class, null); } Then, on the controller, i…
Efraín
  • 453
  • 1
  • 7
  • 13
2
votes
0 answers

TypeError: preg_match(): Argument #2 ($subject) must be of type string, array given on linux server

Having this issue on the linux server when accessing data from mongodb using jenssengers package. It does not show up on the local server during development. Below is the complete error i…
2
votes
0 answers

Jenssegers\Mongodb hasMany to hasMany relation

I am trying to get a hasMany of hasMany using jenssegers-mongodb library. Website model: use Cviebrock\EloquentSluggable\Sluggable; use Illuminate\Database\Eloquent\Model; use Jenssegers\Mongodb\Eloquent\SoftDeletes; use…
Pritam Kadam
  • 3,203
  • 4
  • 19
  • 41
2
votes
3 answers

Error while 'composer require jenssegers/mongodb' adding MongoDB to new Laravel 7 Project

After fresh installation of laravel 7 project, C:\xampp\htdocs\blog>composer require jenssegers/mongodb --ignore-platform-reqs But this is giving an error. Your requirements could not be resolved to an installable set of packages. Problem 1 …
RoshJ
  • 461
  • 1
  • 6
  • 24
2
votes
1 answer

BelongToMany when primary key is another column of related model

i have two table widget and page_widget PageWidget model: protected $fillable = [ 'page_id', 'widget_codes', 'created_by', 'updated_by', 'deleted_by', 'deleted_at' ]; relation in this model: public function widgets() { …
2
votes
1 answer

Laravel mongodb aggregation

Is it possible to use external variables inside the raw function? $var = 'example'; $res = DB::collection("{$var}_products")->raw(function($collection) { global $var; return $collection->aggregate([ ['$lookup' => [ …
VladR
  • 93
  • 8
2
votes
1 answer

How to use MongoDb specific operator $size to find array size greater than, less than, between and not equal to a value in Laravel / jenssegers?

I am working on a Laravel dynamic where clause eloquent model. I want to find the collection with the size of an array field having size values greater than, less than, between and not equal to. I am using jenssegers and in the jenssegers…
Abhi Das
  • 500
  • 8
  • 11
2
votes
1 answer

Data format issue for related models (Laravel / jenssegers/laravel-mongodb)

Here is an open bug on Github for the laravel-mongodb package, but there is no response. Maybe someone knows a solution..? When selecting as single doc, dates displays as a date { "_id": "5ca71ce0d542352064004034", "title": "General…
Denys Siebov
  • 198
  • 4
  • 16
2
votes
0 answers

How to use embedsMany in laravel to get all attributes? Only foreign key is returning

Hello Good Developers, I am trying to implement embedsMany relationship of jenssegers/laravel-mongodb I have two collections: ProfileSection - { "_id": "5c865ea4257db43fe4007331", "general_name": "MY_PROFILE", "type": "public", "points":…
Pankaj Jha
  • 886
  • 15
  • 37
1 2
3
12 13