public function _exportToCSV($status){
$columnHeader = "";

$setData = '';

$findAll = ImportUsers::model()->findAll("status = $status");
if(!empty($findAll)){
foreach($findAll as $objData){
$rowData = '';
$value = '"' . $objData->title1 . '"' . "\t";
$value .= '"' . $objData->title2 . '"' . "\t";
$value .= '"' . $objData->title3 . '"' . "\t";

$rowData .= $value;
$setData .= trim($rowData) . "\n";
}
}
$fileName = 'output.csv';
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename = $fileName");
header('Content-Transfer-Encoding: binary');
header("Pragma: no-cache");
header("Expires: 0");

echo chr(255).chr(254).iconv("UTF-8", "UTF-16LE//IGNORE", $setData . "\n");

exit();
}

Enjoy.

--

--

1: Change Collection Field To “utf8_persian_ci

2: In Query

SELECT * FROM campaigns ORDER BY title COLLATE utf8_persian_ci

3: In Yii Framework

$academics = Academic::find()

->where([

‘organization_id’ => $_POST[‘organization’],

‘academic_year_id’ => $_POST[‘academicYear’],

‘base_id’ => $_POST[‘base’],

‘field_id’ => $_POST[‘field’]

])

->andWhere([‘IN’,’status’,$arrayStatus])

->joinWith(‘profiles p’)

  • >orderBy(new \yii\db\Expression(‘p.lname COLLATE utf8_persian_ci’));

Enjoy It.

--

--

let aggregateTotal = [];
let aggregateMatch = {};
if (searchServiceDto.hasOwnProperty('code')) {
Object.assign(aggregateMatch, {
codeStr: new RegExp(searchServiceDto.code.toString()),
});

}
aggregateTotal.push(
{
$addFields : {
codeStr: {
$toString: '$code'
}
}
}
)
aggregateTotal.push({
$match: aggregateMatch,
});
aggregateTotal.push(
{
$project : {
codeStr: 0
}
}
)
let data = await this.serviceSoftModel.aggregate(aggregateTotal);

type code in MongoDb is number

--

--

1: name:: batch_for_dump.bat

2:

@ECHO OFF
for /f “skip=1” %%i in (‘wmic os get localdatetime’) do if not defined fulldate set fulldate=%%i
set year=%fulldate:~0,4%
set month=%fulldate:~4,2%
set day=%fulldate:~6,2%
set foldername=%year%_%month%_%day%
md C:\data\db\%foldername%
mongodump — host=*.*.*.* — port=*** — username root — password ****— db mom_*** — authenticationDatabase admin -o C:\data\db\%foldername%
PAUSE

3:

Result:

--

--

console.log('starting classify...')
//let classification = await client.classifyText({ document });

/**
* handel classify error start
*/
let classification : any;
const operation = new Promise<any>((resolve, reject) => {
client.classifyText({ document }).then(
(onResolved) => {…

--

--