JayData MongoDB provider Pro
- On 17th May 2015
- Posted by Orsolya Jusztin
- jaydata pro
Why choose MongoDB Provider Pro
JayData Pro product line is for professional users. Pro products come with support and extra features. The features have been selected and developed with business apps in mind. MongoDb Pro extra features allow app developers to publish MongoDB-based services on node.js platform with advanced features over standard protocols and with standard formats (OData, REST, JSON). With professional support developers can save long hours of precious time and they can get fast bugfixes and patches if needed.
Features
MongoDB Provider Pro gives you all the features that the community version provides with the same syntax, they are interchangeble. The Pro version can work both with the community version of JayData Server and with JayData Server Pro. However, the Pro version adds new features that are missing from the community version.
Indices
MongoDb has built-in index support. With MongoDb Provider Pro you can utilize this feature from JayData. Indices must be declared with the Entity Context declaration, JayData creates the indices on the database. MongoDb automatically updates the indices when a new record is inserted or a record is updated or removed. However, MongoDb does not selects the best index to be used for a given query. JayData handles this, but it is essential for the developers to understand how it works and optimize the indices and the filters accordingly. It is the responsibility of the developer to declare the necessary indices, when a query can not use any index then the database must do a full table scan which can be slow, having too many indices might slow down inserts and updates and might take a lot of space.
http://jaydata.org/blog/database-indices
Geo features
Do you want to create awesome geo-enabled apps, store geospatial data in MongodDB and query POIs easily? MongoDB Provider Pro is the tool for you! JayData Server helps you to run this geo-query over standard protocols and with standard formats (REST/OData/JSON) from your HTML5, JavaScript, PhoneGap, native mobile apps or .NET, Java applications.
However you can create, retrieve, update and delete points in the open-source version of JayData MongoDB Provider, you can query them by distance and area only by using the Pro version.
Saving points to MongoDB from JavaScript using JayData library
$data.GeographyPoint type represents a single geography point. The constructor accepts the longitude and latitude in various formats:
1 2 3 4 5 6 7 |
<span class="rem">//creating JayData Geo objects</span> var geo = <span class="kwrd">new</span> $data.GeographyPoint( { lat: 47.498333, lng: 19.040833 } ); <span class="rem">//accessing coordinates of JayData geo objects</span> console.log(geo.latitude, geo.longitude); <span class="rem">//saving geo objects with MongoDB</span> context.POI.add(geo); context.saveChanges(function () { ...}); |
Querying points by distance
With this functions you can find points within a circle, the center of the circle and the radius are parameters.
1 2 3 4 5 6 7 |
context.POI .filter(<span class="str">'it.coord.distance(p) < r/R'</span>, { p: e.latlng, r: 500, R: 6371000 }) .toArray(function (result) { ... }); |
Find points within a polygon (intersects)
The intersects() comes handy if you want to find points in a certain areas of the map to retrieve only the visible points.
1 2 3 4 5 6 7 8 |
context.POI .filter(<span class="str">'it.coord.intersects(p)'</span>, { p: { topRight: lmap.getBounds().getNorthEast() , bottomLeft:lmap.getBounds().getSouthWest() } }) .toArray(function (result) { ... }); |
The results can be displayed on Google Maps, Leaflet, Bing or Nokia Here. Read more about geo features and check out the live geo examples!
You can download the 30 days trial or buy MongoDb Provider Pro from JayStack Dashboard.
0 Comments