All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ssssssss.magicapi.modules.MongoFindIterableExtension Maven / Gradle / Ivy

package org.ssssssss.magicapi.modules;

import com.mongodb.client.FindIterable;
import com.mongodb.client.MongoCursor;
import org.bson.Document;
import org.ssssssss.script.annotation.Comment;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Mongo FindIterable 方法扩展
 */
public class MongoFindIterableExtension {

	@Comment("结果转为List")
	public List> list(FindIterable iterable) {
		MongoCursor cursor = iterable.iterator();
		List> result = new ArrayList<>();
		while (cursor.hasNext()) {
			result.add(cursor.next());
		}
		return result;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy