Git Product home page Git Product logo

mongo-oda-birt's Introduction

About

This project includes patches that I have made to the mongo-oda-birt-plugin http://code.google.com/a/eclipselabs.org/p/mongo-oda-birt-plugin/.

The examples data set is downloaded from http://media.mongodb.org/zips.json and imported into your MongoDB instance using this command:

mongoimport --db test --collection zips --file zips.json

Change Log

Support Regular MongoDB Query Syntax

When constructing a query, you can now use regular MongoDB syntax.

db.collection.find( <query>, <projection> )

For example, to query all elements in the dataset use:

db.zips.find()

ScreenShot

But you can perform filtering on the server:

db.zips.find({state: "IA"})

ScreenShot

This can be benefical/necessary on very large databases.

ScreenShot

All valid MongoDB query statements should be supported, see the MongoDB Guide for further details on the syntax of advanced query operations.

The query may include both a filter's and When you specify a query using MongoDB syntax (i.e. is starts with "db.") additional features will be enabled. If you specify the query as the collection name, then the legacy 1.0.0 behavior is used.

As part of the query, you can also specify the "projection" to be used, which will limit the returned columns. For example:

db.zips.find({state: "IA"}, {"city": 1, "pop": 1})

ScreenShot

Will produce:

ScreenShot

To use a projection without a filter, use this syntax:

db.zips.find({ }, {"city": 1, "pop": 1})

Work Correctly With Heterogenous Documents

Because MongoDB is schema-free, not all documents in the collection will have the same set of keys. With version 1.0.0 of mongo-oda-birt, the first document in the collection was used as the 'prototype'. If you don't provide any column restrictions or a query projection, all columns across the entire data-set will be available. For example, add the following into the 'zips' collection:

$ mongo MongoDB shell version: 2.0.4 connecting to: test

db.zips.insert({"field1": "X", "field2": "Y", "field3": "Z"})

The new columns will now be available in your data-set.

ScreenShot

Easier Access to FilterCriteria and SortCriteria

In 1.0.0, FilterCriteria and SortCriteria were tied to DataSet parameters. This caused two problems:

  • The DataSet wizard would issue ominous errors about vaguly named parameters not having a default value, and
  • Constructing the JSON statement as part of the report parameter was awkward for users, especially if multiple report parameters were to be combined into a single filter.

Of course, this is only necessary if you want to filter on the server-side. Alternatively you can filter on the client side as either part of the data-set or as part of your report design. The client-side filters provided by BIRT have more capabilities that those provided by Mongo, so it's often easier to used those. The server-side filters are useful to reduce the amount of data that is fetched and processed.

In 1.1.0, when you use the new db..find() query syntax these parameters are not longer used. For backwards compatibility, these are still used if you define a query with the legacy syntax.

Now you can specify these criteria as properties:

ScreenShot

A simple criteria can look like this:

({state: params["State"].value}).toSource()

This will generally work, except for when the report parameter is "null", the behavior will be to find all documents that have now value for the state column. This can be especially problematic if you have a report parameter with a dynamic lookup.

Although more verbose, it's better to define your FilterCriteria in this manner.

filter = {}
if (params["State"].value) {
   filter.state = params["State"].value
}
if (params["MinimumPopulation"].value) {
   filter.pop = params["MinimumPopulation"].value
}
filter.toSource()

ScreenShot

Results in:

ScreenShot

IMPORTANT: If you specify a FilterCriteria property value, the filter criteria (if any) specified in the original query is ignored. In legacy mode, the FilterCriteria parameter has higher priority than the FilterCriteria property.

SortCriteria can be specified in the same manner. For example, to create a static sort (note that the critera field was set to be a constant instead of a JavaScript expression).

ScreenShot

Inferred Data-types Follow Types in the Database

In 1.0.0, date fields would be treated as strings. In 1.1.0, date fields are correctly inferred to be dates. In addition, in 1.0.0 a string "0.123" would be inferred to be a number. In 1.1.0 a string is considered a string regardless of it's content. You can always adjust the column types manually if necessary. If the first document doesn't include all of the columns, the types will initially be set to be a string.

Fixing Default Logging

By default, 1.0.0 would produce a log with the .metadata area of your workspace as the FINEST level of logging. As such, this file could grow very large and it could potentially reveal sensitive data (since it is dumping all of the conents of the database operations to the log).

In addition, when the ODA plugin is used on Linux within an application-server (i.e. Tomcat) you cannot specify a default log directory of "C:\temp".

Making the UI more Friendly

I've made minor changes to help make the UI more intuitive.

Created a Feature and Update Site

To make it easier to install, an update site is now available. Point to this update site to install:

http://raw.github.com/maihde/mongo-oda-birt/master/org.eclipse.birt.report.data.oda.mongodb.site

Or download an archived update-site: org.eclipse.birt.report.data.oda.mongodb.1.1.0.zip

License

Eclipse Public License 1.0 Copyright (C) 2010-2012 Pulak Bose Copyright (C) 2013 Michael Ihde

mongo-oda-birt's People

Contributors

maihde avatar

Stargazers

 avatar Arun N. Kutty avatar Bicherele avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

mongo-oda-birt's Issues

mongoDB , Birt Error

db.test.find ( { time : { $gte : ISODate("2013-08-19 05:09:56"), $lt:ISODate("2013-08-19 05:10:02") } } )

i have used above command but it gives error
please let me know, how to correct this issues

$where?

Should $where work?

I'm trying to use

db.foo.find({ "$where" : "this.date > new Date('2013-06-11 14:00+0')" })

but Birt complains there is a syntax error (it works fine in MongoVUE)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.