2015년 1월 6일 화요일

[AngularJS] Filtering geojson change dynamically in table and on map

Right now i try to figure out how to make geojson filter with ng-model search

I know that geojson has attribute filter, so my question is how should it be done ? I assume there is no way to do simple geojson | filter:search, so it should be done on the side of angular?

I found good solution but it works only with mapbox, it is possible to do something like below with leaflet-angular-directive?

<mapbox map-id="examples.map-i86l3621" lat="11.403569" lng="8.329453" zoom="3">
    <div ng-repeat="hf in hf_directory |filter:search"> <marker lat="{{hf.geometry.coordinates[1]}}" lng="{{hf.geometry.coordinates[0]}}" color="#39cccc">    </marker>    </div>
</mapbox>

I use simple filtering 
<input ng-model="search.properties.Primary_Name" placeholder="Primary Name" >

<tr ng-repeat="hf in hf_directory| filter:search">

My Template:

<leaflet id="map" center="center" defaults="defaults" geojson="geojson">

</leaflet>

I use leaflet-angular-directive and it looks like this:
    
var AppMapDirectory = angular.module('DirectoryAppMap', ['ngResource', 'leaflet-directive']);
AppMapDirectory.factory("Directory", function($resource) {
   return $resource("json/result.json", {}, {
       get: {
           method: "GET",           cache: true       }
   });});


AppMapDirectory.controller("DirectoryMapList", ["$scope", "Directory", "$filter", function($scope, Directory, $filter) {




    Directory.get(function(data) {

       $scope.hf_directory = data.features;

        function onEachFeature(feature, layer) {
                layer.bindPopup("<b>Name:</b> " + feature.properties.Name +
                    "<br><b>Category:" + feature.properties.Category +
                    "<br>Primary Name:" + feature.properties.Primary_Name + "");            }


         angular.extend($scope, {
           geojson: {

               onEachFeature: onEachFeature,               data: $scope.hf_directory           }

       });

       });

    angular.extend($scope, {
        defaults: {
            tileLayer: "https://dnv9my2eseobd.cloudfront.net/v3/foursquare.map-ikj05elx/{z}/{x}/{y}.png",            maxZoom: 14,            minZoom: 1        },        center: {
            lat: 8.1238,            lng: 11.8777,            zoom: 2        }
    });





Actually i wrote simple filter function for geojson, but maybe somebody could show me direction how to make that this function will work together with input ng-model search?
The  way as i did it is not dynamic

function filter(feature) {
    return feature.properties.PrimaryName == "somename";
}

         angular.extend($scope, {
           geojson: {
              onEachFeature: onEachFeature,               data: $scope.hf_directory,               filter:filter           }

       });


[tokumx-user] find or fineOne slow

Could you send us:

db.collection.findOne()
db.collection.find().explain()
db.collection.findOne().explain()
db.collection.getIndexes()

on all shards, and from mongos














Lost database using monggodb

Hello. I'm having a problem with my web project. I'm using MongoDB2.6.5 and have the following problem: Some of my data Province lostfor unknown reasons.
Looking forward to the help soon.



Hello. I'm having a problem with my web project. I'm using MongoDB2.6.5 and have the following problem: Some of my data Province lostfor unknown reasons.
Looking forward to the help soon.

Hi,


We're going to need more details to try to help. What do you mean by "lost" (deleted? can't find?) and what exactly has been lost (an entire database, some fields in your documents, some documents, ..)?



I removed MongoDB from Windows Service by using "mongod --remove", and then "mongod --repair". But when I restart the db, all the databases have lost except for "local". Could you please help me? 



I removed MongoDB from Windows Service by using "mongod --remove", and then "mongod --repair". But when I restart the db, all the databases have lost except for "local". Could you please help me? Thank you.

Hi,

Removing the service with `mongod --remove` does not delete any data files.

How did you restart mongod -- from the command line, or by reinstalling as a service? I suspect you either used a different dbpath or didn't specify one (so the Windows default of "c:\data\db" was used). The "local' database is automatically created with a capped collection "startup_log".

If you're not sure if there was a different dbpath previously, I would try searching for any directories with "local.ns" (namespace file for the "local" database). The data directory should include other files for each database: a name space file (<database>.ns) and 1 or more  files named like <database>.0, <database.1>, etc.


DB access[Read/Write] slow

Our Mongo DB version : 2.4.3
Mongo Java driver : 2.11.3


process1:
slaveok=false

we are reading and writing to db1, the load is approx 100 hits/ seconds.

process2:

slaveok=false
we are reading and writing to db2, the load is approx 10 hits/ seconds.

But whenever the process1 is running process2 also taking more time to respond.

Note : All collections in db1 and db2 are not sharded.Each db has 40 collections and maximum document for a collection is 400,000.

My question is that DB level lock may slow down the collection owned DB [db1], but why the db2 based process is getting slow?

And also Please help me to take the longterm solution for this problem?

Shall I shard all collection in db1 and db2?
Shall I make the slaveok=true? [but it'll give stale data]?
Does Mongo db upgrade give any solution for this?


[casbah] Casbah 2.8.0-RC1 released

The 2.8.0-RC1 Casbah (Scala) Driver has been released. 

This is a release candidate and as such is not recommended for production use.  

This is the second release candidate adds support for the latest MongoDB 2.8 release candidate. Please review the change log athttps://github.com/mongodb/casbah/blob/2.8.0-RC1/src/sphinx/changelog.rst#changes-in-version-280-rc1

As always, please let us know if you have any problems by opening an issue at https://jira.mongodb.org/browse/CASBAH or posting any issues / questions here.


[mongodb-csharp] Unable to connect to server X.X.X.X:YYYY: Invalid credential for database 'admin'..

I recently updated from version 1.7.0 to the prerelease of 1.9. Now when I try to run my project, I get the following error:

    Unable to connect to server X.X.X.X:YYYY: Invalid credential for database 'admin'..

where the server and port are actual vaules rather than X/Y.

When I revert to version 1.7, everything works fine. Version 1.7.1 also works. Version 1.8.0 manifests the error.
What has changed?  How do I fix this? What other issues am i going to run up against in upgrading? Where can I find an upgrade guide for the csharp driver?



The way credentials are parsed out of the connection string are different, starting in 1.8.  There are some warnings about this in the docs.

I assume your credentials are for a specific database other than admin?  If so, you'll need to specify the database in your connection string.  Consult the official connection string documentation: http://docs.mongodb.org/manual/reference/connection-string/



Thanks for your response. I looked at the documentation and cannot see a problem with my connection string. Here is the format I am using:
    mongodb://myname:mypass@24.24.24.24:24242
This should be valid according to the docs



I see the problem. Thanks for your response. 

What other things should I watch out for in the upgrade? Is there an upgrade guide?



There are release notes for 1.8, 1.8.1, 1.8.2, and 1.8.3.  We also have some for 1.9.  You can read those for the gist of what has happened since 1.7.

Other than that, there aren't many other breaking changes unless you were using conventions heavily in your codebase.  If you were, things mostly should continue to work and as long as your tests pass, everything is ok.



i also had this problem

this cn work fine:
"mongodb://userr:pass@address:27017/dbapplications?slaveOk=true;readPreference=nearest;replicaSet=test1;minPoolSize=50";


Lost data using mongodb

Hello. I'm having a problem with my web project. I'm using MongoDB2.6.5 and have the following problem: Some of my data Province lostfor unknown reasons.
Looking forward to the help soon.