Github user LosD commented on the issue:
https://github.com/apache/metamodel/pull/171
Played around with it a bit in a scratch file and a Dockerized Mongo.
WHEREs with map keys seems to work quite nicely (though I was quite hampered
from my limited knowledge of Mongo), also without the explicit selection.
However, A SELECT with a SUBSTRING seems broken, or I'm using it wrong,
A `SELECT SUBSTRING(item, 1, 4) from inventory` with the values "journal"
"mat" and "mousepad" should have yielded "jour", "mat" and "mous" (or "ourn",
"at" and "ouse" if it's supposed to be 0-indexed... Which it looks like in code
and tests, but seems quite odd in an SQL-like query), but instead yielded
"ournal, "at" and "ousepad", seemingly ignoring the second limit. I saw
something similar when trying to use it in there WHERE clause.
Here's the quite simple code snippet:
``` Java
import org.apache.metamodel.DataContext;
import org.apache.metamodel.data.DataSet;
import org.apache.metamodel.mongodb.mongo3.MongoDbDataContext;
import org.apache.metamodel.util.SimpleTableDef;
import com.mongodb.MongoClient;
class Test {
public static void main(String[] args) {
final DataContext mongoDbDataContext =
new MongoDbDataContext(new
MongoClient("192.168.99.100").getDatabase("test"),
new SimpleTableDef("inventory",
new String[] { "item", "qty", "tags",
"size.h", "size.w", "size.uom" }));
final DataSet ds = mongoDbDataContext.executeQuery("SELECT
SUBSTRING(item, 1, 4) from inventory");
ds.forEach(System.out::println);
}
}
```
Values are those inserted here:
https://docs.mongodb.com/manual/tutorial/insert-documents/#insert-multiple-documents
BTW, for Mongo3, the integration test is a single line from working, so
maybe add a few tests around it to that one.
---