0

My document in mongodb database is like below

{
   "_id": ObjectId("545a20208e227b4c42601601"),
   "polish": NumberLong(3),
   "symmetry": NumberLong(1),
   "certy_no": "6175554509",
   "certy_name": "541bfa1d3d1784380600002f",
   "desc": "Fancy Intense Yellow",
   "intensity": NumberLong(6), 
   "price": NumberLong(4000),
   "weight": 1.04,
}

Now i want to query like "price * weight >2000"

So how this is possible in laravel in jenssegers.

Thanks --ND

Gaurav Dave
  • 6,838
  • 9
  • 25
  • 39
Nishchit
  • 18,284
  • 12
  • 54
  • 81

1 Answers1

0

Query Builder

The database driver plugs right into the original query builder. When using mongodb connections, you will be able to build fluent queries to perform database operations. For your convenience, there is a collection alias for table as well as some additional mongodb specific operators/operations.

I am going to give this a good guess. But try this and let me know how it goes.

$results = SomeClass::where('(price * weight)', '>', 2000)->get();
Rafael
  • 7,605
  • 13
  • 31
  • 46