AnsweredAssumed Answered

I am unable to fetch a list of specific "_id" for a set of documents.

Question asked by mufeed on Apr 4, 2017
Latest reply on Apr 4, 2017 by mufeed

Say you have the following sample code and JSON document,

import com.mapr.db.MapRDB;
import com.mapr.db.Table;
import org.ojai.Document;
import org.ojai.DocumentStream;
import java.util.ArrayList;
import java.util.List;

public class MaprIssue {
public static void main(String[] args) {
MaprIssue test = new MaprIssue();

private void tryQueryInMapR() {
Table table = MapRDB.getTable("/mytable");

Document doc1 = MapRDB.newDocument().set("title", "OJAI -- The Documentary")
.set("studio", "MapR Technologies, Inc.")
.set("trailers.teaser", "")
.set("trailers.theatrical", "")
.set("box_office_gross", 1000000000L);

Document doc2 = MapRDB.newDocument().set("title", "OJAI -- The Second Documentary")
.set("studio", "MapR Technologies, Inc.")
.set("trailers.teaser", "")
.set("trailers.theatrical", "")
.set("box_office_gross", 2000000000L);

table.insertOrReplace("1", doc1);
table.insertOrReplace("3", doc2);

DocumentStream stream = table.find("_id"); // -does not work as expected

System.out.println("Iterating ");
List<Document> docs = new ArrayList<>();
for (Document doc : stream) {
System.out.println("size = " + docs.size());


but find by "_id" in this case does not work as expected. Why?