mongodb connector - criteria definition

d4emuellerd4emueller Member Posts: 4 Contributor I
edited November 2018 in Help
Hi,

is there a description, how to write critera for mongodb connector ?

I wrote this snippet for Robomongo. There works. What are the diffs to RapidMiner mongodb connector?

Thanks for help!


db['mycollection'].find(
    {
      time: {
            $gte: ISODate("2015-01-27T00:00:00.000Z"),
            $lt : ISODate("2015-01-28T00:00:00.000Z")                   
      },
      code: '200',
      path: {
            $regex: '/.*pdf*/'
      }
  },
  {
      path : 1,
      size : 1,
      _id : 0         
  }).limit (100)


Regards
Ines

Answers

  • MichaelKnopfMichaelKnopf Administrator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 31 RM Data Scientist
    Hello Ines,

    The Read MongoDB operator allows to specify both a query criteria object and a projection object, as well as to limit the results.

    Thus, you should be able to reuse the JSON objects from your Robomongo query without further modifications.

    Relevant Read MongoDB parameters:

    mongodb instance: MyInstance
    collection: mycollection
    criteria:
    {
           time: {
                 $gte: ISODate("2015-01-27T00:00:00.000Z"),
                 $lt : ISODate("2015-01-28T00:00:00.000Z")                     
           },
           code: '200',
           path: {
                $regex: '/.*pdf*/'
           }
    }
    projection:
    {
           path : 1,
           size : 1,
           _id : 0         
    }
    limit: 100
    skip: 0

    Note that limit and skip are expert parameters that might be hidden by default.

    You might also check out this Getting Started Guide that shows how to setup your MongoDB connection.

    Best,
    Michael
Sign In or Register to comment.