Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to import some Mongodb data into mysql database

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The following mainly brings you how to import some Mongodb data into mysql database. I hope these contents can bring you practical use. This is also the main purpose of this article that I edit part of Mongodb data how to import mysql database. All right, don't talk too much nonsense, let's just read the following.

Filter and export mongodb data based on time

1. First convert the time in mongodb to a timestamp:

ISODate ("2016-12-01 001V 00.000mm 08V") .valueOf ()

1334592000000

Then you can query it according to the obtained timestamp.

Export:

-d is the database

-c is a set

-o File name of the output

-csv means to export to csv format

-f indicates which columns (fields) need to be exported

Filter conditions added by-Q

. / mongoexport-h 127.0.0.1-- port 20017-d xxx-c xxx-- csv-f xxxx-Q'{"status_time": {$gt: new Date (1482681600000), $lt:new Date (1482768000000)}'- o xxxx

Import: enter the mysql database:

LOAD DATA LOCAL INFILE 'export file full path' INTO TABLE database table name FIELDS TERMINATED BY','

For the above about how to import some Mongodb data into mysql database, we do not think it is very helpful. If you need to know more, please continue to follow our industry information. I'm sure you'll like it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report