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

Laravel Jensenggers Eloquent Model sort main model with relation model

I'm trying to sort entire dataset of main model through column of relational model. I am using Laravel ORM 5.2.43 and Jensenggers MongoDb 3.1 Here are the models I have UserEventActivity.php - Mongo Model use Jenssegers\Mongodb\Eloquent\Model as…
Haridarshan
  • 1,898
  • 1
  • 23
  • 38
4
votes
1 answer

Yajra laravel datatable package not working properly in laravel 5.1 with mongodb

I have installed yajra/laravel-datatables-oracle package for supporting serverside datatables in laravel 5.1 with mongodb 3.3 as database. I have connected laravel 5.1 with mongodb through jenssegers-mongodb package. It is connecting successfully ,…
Haseena P A
  • 16,858
  • 4
  • 18
  • 35
4
votes
1 answer

How to compare 2 'created_at' dates in Laravel 4.2 Mongodb

In my application the user can view an image and click on the 'next' or 'previous' photo button. Currently, the logic for pulling the next / previous image urls is based on the 'created_at' field. I am trying to pick all documents from my collection…
Anuj
  • 41
  • 2
4
votes
3 answers

MongoDb Update only one value from array

I have a collection in mongodb which looks like this. "_id" : ObjectId("554c5397ccfff21e103c9869"), "name" : "test", "color" : [ "552ced22ccfff2d8183c986a_Jellow", "551fdd24ccfff2362e3c9869_test" ], "updated_at" :…
Sameer Shaikh
  • 273
  • 1
  • 9
  • 21
4
votes
1 answer

Jenssegers MongoDB "like query" returning blank array on ISODate

I have the following query but it's returning an empty array (I know for a fact that this query should return one record) $created_at = date("Y-m"); $content = ContentModel::where('userId', $id->_id) ->where('created_at', 'like',…
Haseeb
  • 190
  • 1
  • 6
  • 16
3
votes
1 answer

Laravel mongodb transactions does not rollback

I need to use transactions on mongodb in laravel-5.8. I am using jenssegers-laravel-mongodb and use like below snippet in my code but it does not rollback when one of queries failed. $session =…
Nice91
  • 91
  • 9
3
votes
1 answer

Laravel - Jenssegers MongoDB nested array update not working

can someone please point out what wrong with my code? I am trying to update a nested array in MongoDB via Laravel Jenssegers. Here is my code $update_status = Journal::where('_id', "5cd10b325586e9122761f675" ) ->update( [], […
VishnuPrasad
  • 1,078
  • 5
  • 17
  • 36
3
votes
0 answers

Laravel & MongoDB: Cannot drop an existing collection using migrate:fresh

I am unable to drop MongoDB collections by running migrate:fresh. The project is on Laravel 5.7 and we are using jenssegers/laravel-mongodb. When I try to run migrate:fresh, an error comes up saying MongoDB\Driver\Exception\CommandException : a…
3
votes
1 answer

MongoDB aggregate + $match + $group + Array

Here is my MongoDB query : profiles.aggregate([{"$match":{"channels.sign_up":true}},{"$group":{"_id":"$channels.slug","user_count":{"$sum":1}}},{"$sort":{"user_count":-1}}]) Here is my Code : $profiles = Profile::raw()->aggregate([ [ …
Prafful Panwar
  • 439
  • 7
  • 19
3
votes
0 answers

MongoDB query for aggregate function retuning empty result

Following is the query i had written to get the count based on event name. $data= DB::collection(Events::$collection)->raw(function($collection) { return $collection->aggregate([ ['$match' => ['appid' => 1]], ['$group' => ['_id'…
Chiru Adi
  • 647
  • 4
  • 21
3
votes
0 answers

MongoDB Connect Issue jenssegers/laravel-mongodb

I'm using jenssegers/laravel-mongodb MongoDB Jenssegers I'm running into an issue where I can't seem to connect using the framework, but using a simple test script, I can connect fine. The simple connection script I wrote:
Docmur
  • 336
  • 2
  • 12
3
votes
1 answer

Laravel + MongoDB - Retrieving all embedded models?

Let's say there is a User model that embedsMany House models. public function houses() { return $this->embedsMany('App\House'); } Is there a way to directly retrieve a list of all houses for all users, without first retrieving all…
ignite-me
  • 738
  • 3
  • 14
  • 33
3
votes
3 answers

Laravel 5.3 Getting beginTransaction() on null error for queue:work artisan command

When I'm, trying to run php artisan queue:work command, I'm getting this error: [Symfony\Component\Debug\Exception\FatalErrorException] Call to a member function beginTransaction() on null I have checked almost all the available help for this error…
Parth Vora
  • 4,073
  • 7
  • 36
  • 59
3
votes
2 answers

Querying a collection with an array of mongoID

I have the following code: // company_ids is an array of mongo IDs // company_id is an array (with only 1 element) of mongo ID foreach($company_ids as $company_id){ $results = Archive::where("billing.company._id", 'all',…
Edwin
  • 886
  • 2
  • 13
  • 32
3
votes
1 answer

Laravel MongoDB Jenssegers How to get "_id" of a document

I'm trying to get a list of users in MongoDB. The _id is empty, so I can't process it properly. How can I get the _id of a document using MongoDB for Laravel? { "total": 1, "per_page": 15, "current_page": 1, "last_page": 1, …
1
2
3
12 13