2017-09-05 17 views
0

mongodbデータを操作するのにlaravel-mongodbhttps://github.com/jenssegers/laravel-mongodb)を使用しています。laravel-mongodbを使って新しいMongoDBコレクションを作成するには?

laravel-mongodbを使って新しいMongoDBコレクションを作成する方法は?例えば

public function test() 
{ 
    $newArtciels = DB::connection('mongodb')->collection('articles')->where('status', '1')->get(); 

    //I want to ceate a new collection `new_artciels`, and save `$newArtciels` into `new_artciels`,how to write next? 
} 

質問:
私は新しいコレクションnew_artcielsをceate、およびnew_artciels$newArtcielsを保存したい、私は何をすべき?

答えて

0

モデル

<?php 

namespace App; 
use Jenssegers\Mongodb\Eloquent\Model as Eloquent; 

class new_artciels extends Eloquent 
{ 
    protected $collection = 'new_artciels';} 

コントローラ

use App\new_artciels; 

これはあなたのために働く必要があります。

関連する問題