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
2
votes
1 answer

Laravel MongoDB - aggregation, ordering query

I am wondering how could I achieve a specific result. Starting of I am using https://github.com/jenssegers/laravel-mongodb The code sample below is used to get an array of documents that contains my specific slug in the rewards node. And till that…
2
votes
1 answer

MongoDB + Laravel + jenssegers/laravel-mongodb + update nested child elements

Hellow folks, I am new to MongoDB and looking for some answer Is there any way to update nested array without looping it. foreach ($post->comments as $key => $comment) { if ($comment['posted_by'] == $authUser['id']) { $data = $post->update([ …
Prafful Panwar
  • 439
  • 7
  • 19
2
votes
1 answer

Sort on the number of related (hasMany) documents

I have 2 collections. Vehicles and Views. I would like to bring back a list of vehicles sorted by the number of views. My Vehicle class class Vehicle extends Moloquent { protected $dates = ['date_assigned']; public function…
JBxOnline
  • 1,339
  • 1
  • 9
  • 10
2
votes
3 answers

Laravel 5.5 Mongo DB error

I am developing a Mongo DB app in Laravel 5.5. But getting following error in the package https://github.com/jenssegers/laravel-mongodb. Declaration of Jenssegers\Mongodb\Eloquent\HybridRelations::belongsToMany($related, $collection = NULL,…
Kiren S
  • 3,037
  • 7
  • 41
  • 69
2
votes
0 answers

MongoDB + Laravel fetch value if field exists in array otherwise fetch value from another field in array

I am working with laravel 5.3 and jenssegers-mongodb. I have following document in MongoDB : { "_id" : ObjectId("590fgfhddfgdfgdfgdg"), "name" : { "en" : "Meeting", "gu" : "બેઠક" }, }, { "_id" :…
2
votes
0 answers

Laravel 5.4 with mongodb: how to query data from multiple collection by using reference id

Here are the collections I'm working with Fee package collection { "_id": ObjectId("591abc701c9dfa0a6e7608e6"), "fee_package_name": "abc", "fee_structure": [{ "fee_name": "Fee1", "fee_amount": 1550 }, …
Vittal ks
  • 108
  • 1
  • 7
2
votes
0 answers

Multiple Nested Group Within Array in MongoDB using laravel

Please refer this question which was posted by my friend. Multiple Nested Group Within Array Here chridam has given a good answer but we have to implement in laravel php framwork.
2
votes
2 answers

hasMany relationship issue in Laravel 5.3 + MongoDB library 'jenssegers/laravel-mongodb'

I am using MongoDB library in Laravel 5.3. I have two collections in MongoDB and I want to make a hasMany relation b/w them. MongoDB: 1st Collection: Employee { "_id" : ObjectId("586ca8c71a72cb07a681566d"), "employee_name" : "John", …
okconfused
  • 3,567
  • 4
  • 25
  • 38
2
votes
1 answer

Calling Mongodb stored functions on an insert in php

I'm using Mongodb 3.2 with PHP in Laravel with Jensseger laravel-mongodb, documentation here: https://github.com/jenssegers/laravel-mongodb I'm inserting data through this code and it works fine: $clientes =…
Bob Lozano
  • 838
  • 2
  • 13
  • 38
2
votes
0 answers

Issue with Laravel 5.2 and jenssegers/laravel-mongodb

I am trying to integrate mongodb to an application I am developing with Laravel 5.2. I have mongodb installed on my computer and the php driver working correctly (I have a standalone php file with a very basic connection to my database and the…
pgzm29
  • 160
  • 1
  • 13
2
votes
2 answers

laravel authentication and jenssegers-mongodb not working

Hello i am using laravel, mongoDB and AdminLTE template in my project. for mongoDB i am using jenssegers/laravel-mongodb. But now i am facing error when i creating login authentication in laravel controller this my code in AuthController.php …
sandip kakade
  • 1,346
  • 5
  • 23
  • 49
2
votes
1 answer

Laravel MongoDB group by

I'm currently using jenseggers-mongodb eloquent in laravel 5 with mongodb 3.0.3. I'm trying to join two different tables as follows: User Model public function userpayment() { return $this->hasMany('App\Models\Userpayment', 'user_id',…
varathanyajiv
  • 136
  • 1
  • 2
  • 10
2
votes
0 answers

Laravel Mongodb Or where in not working as it should be

My Query is: Collection::WhereIn('email',$email)->orWhereIn('mobile',$mobile)->get(); The Mongo query which is getting executed…
Sameer Shaikh
  • 273
  • 1
  • 9
  • 21
2
votes
1 answer

Embedded references in jenssegers/laravel-mongodb to prevent data duplication

I've collections: users, organisations, emails. A user can have 1..* emails. Even so an organisation can have 1..* emails. Without linking tables (that's the NoSQL principe), these are my collections: User Collection: [{'_id':…
schellingerht
  • 5,726
  • 2
  • 28
  • 56
2
votes
2 answers

Eloquent Outside of Laravel with jenssegers/laravel-mongodb multiple DB connections

I am trying to connect Eloquent to multiple databases sqlserver for the default and mongodb for the secondary connection. I am using jenssegers/laravel-mongodb pulled in using composer. Here is my database file use…
gmann1982
  • 97
  • 1
  • 9