$cart = Cart::where('user_id', $request->user_id)->push('cart', [
"uuid" => uniqid(),
"product_id" => $request->product_id,
"product_type_id" => $request->product_type_id,
"address_id" => $request->address_id,
"voucher_id" => $request->voucher_id,
"coureer_id" => $request->coureer_id,
"note" => $request->note,
"qty" => $request->qty,
"type" => $request->type,
"expired_at" => $this->addWeekFromCurrentTime(4),
"created_at" => $this->getCurrentTime()
]);
how to change a key value in mongodb when i push data with moloquent
when i push, mongodb always generate a incremental key, how can i change it ?
You must override _id becouse MongoDB always generate default ID for your bson or if you want disable it you could create colletions without default index
db.createCollection("coll", { autoIndexId: false })
this could be done in mongo console