-
Notifications
You must be signed in to change notification settings - Fork 1.5k
-
- Laravel-mongodb Version: dev-develop
- PHP Version: 7.4.2
- laravel vertion 7.X
Description:
Steps to reproduce
- I have used the geospatial index as stated in document
- Having error while insertion "Can't extract geo keys"
Expected behaviour
Tell us what should happen
Actual behaviour
I am having the code as
$property->location = ['type'=>'Point','coordinates'=>[22.85,88.95]]
used schema as
$collection->geospatial('location','2dsphere');
i cant find what is wrong? please help
Beta Was this translation helpful? Give feedback.
All reactions
@divine thanks for replying.
As the latest version was not working. Now I used "jenssegers/mongodb": "^4" and updated the composer but same problem.
I have mongodb --version v3.6.3
This is the error I am getting
Can't extract geo keys: { _id: ObjectId('5f868fd3da8d1f75472157a2'), property_name: "Galwan House", user_id: 30, property_slug: "galwan-house", property_address_line_1: "dhdfhr", property_address_line_1_ar: null, property_address_line_2: null, property_address_line_2_ar: null, property_nearest_landmark: "dfhfd", property_nearest_landmark_ar: null, property_country: "India", property_state: "West Bengal", property_zipcode: "700063", property_location: { type: "Poin---134
I have cre...
Replies: 2 comments 3 replies
-
Hello,
Why are you using dev-develop version?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions
-
@divine thanks for replying.
As the latest version was not working. Now I used "jenssegers/mongodb": "^4" and updated the composer but same problem.
I have mongodb --version v3.6.3
This is the error I am getting
Can't extract geo keys: { _id: ObjectId('5f868fd3da8d1f75472157a2'), property_name: "Galwan House", user_id: 30, property_slug: "galwan-house", property_address_line_1: "dhdfhr", property_address_line_1_ar: null, property_address_line_2: null, property_address_line_2_ar: null, property_nearest_landmark: "dfhfd", property_nearest_landmark_ar: null, property_country: "India", property_state: "West Bengal", property_zipcode: "700063", property_location: { type: "Poin---134
I have created the schema as
$table->index(['property_location' => '2dsphere']);
The way I am inserting the data is
$property->property_location = ["type" => "Point", "coordinates" => [$request->lng, $request->lat]];
$property->save();
what I am doing wrong?
Thanks in advance !!
Beta Was this translation helpful? Give feedback.
All reactions
-
I don't know why are you still trying to use version ^4, use 3.7 for L7.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions
-
I changed the version to 3.7 then also same issue
jenssegers/mongodb v3.7.0 A MongoDB based Eloquent mod...
Thanks!!
Beta Was this translation helpful? Give feedback.
All reactions
-
Basically you have error that says Can't extract geo keys
. Check that you're validating coordinates before saving.
Thanks!
Beta Was this translation helpful? Give feedback.