/*
package mobvista.prd.datasource.retargeting;

import com.mongodb.MongoClient;
import com.mongodb.client.FindIterable;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoCursor;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.model.Filters;
import org.bson.Document;

*/
/**
 * @package: mobvista.prd.datasource.retargeting
 * @author: wangjf
 * @date: 2019/5/23
 * @time: 下午3:30
 * @email: jinfeng.wang@mobvista.com
 * @phone: 152-1062-7698
 *//*

public class MongoJdbc {
    public static void main(String[] args) {
        try {
            // 连接到 mongodb 服务
            MongoClient mongoClient = new MongoClient("13.228.176.169", 27017);

            // 连接到数据库
            MongoDatabase mongoDatabase = mongoClient.getDatabase("new_adn");
            System.out.println("Connect to database successfully");

            MongoCollection<Document> collection = mongoDatabase.getCollection("campaign_device_id");

            //检索查看结果
            FindIterable<Document> findIterable = collection.find(Filters.and(Filters.eq("updated", 1558597824), Filters.eq("isUpdate", 1)));
            MongoCursor<Document> mongoCursor = findIterable.iterator();
            while (mongoCursor.hasNext()) {
                System.out.println("mongoCursor==>>" + mongoCursor.next());
            }
            //  collection.updateMany(Filters.and(Filters.eq("updated", 1558597824), Filters.eq("isUpdate", 1)), new Document("$set", new Document("isUpdate", 0)));

        } catch (Exception e) {
            System.err.println(e.getClass().getName() + ": " + e.getMessage());
        }
    }
}
*/
