4

I'm using hadoop mongo connector in java(spark application).I've done reading mongo db by setting this configuration

Configuration mongodbConfig = new Configuration();
mongodbConfig.set("mongo.job.input.format", "com.mongodb.hadoop.MongoInputFormat");
mongodbConfig.set("mongo.input.uri", "mongodb://localhost:27017/MyCollectionName.collection");

What can I add to query the data (like .limit(100000))

Mike
  • 4,550
  • 4
  • 33
  • 47
Anil
  • 618
  • 1
  • 7
  • 13

1 Answers1

3

You can add more parameters in the config example:

mongodbConfig.set("mongo.input.query", "{'field':'value'}");

see https://github.com/mongodb/mongo-hadoop/wiki/Configuration-Reference for more details

Ophir Yoktan
  • 8,149
  • 7
  • 58
  • 106