pouchdb / geopouch

Spatial plugin from PouchDB extracted and supporting N dimentional coordinates.
http://pouchdb.com
Apache License 2.0
85 stars 14 forks source link

Issue with Remotedb #16

Open wasa4587 opened 8 years ago

wasa4587 commented 8 years ago

Hello,

var localDB = new PouchDB("test");
var remoteDB = new PouchDB("http://localhost:5984/test");
PouchDB.plugin(geopouch);
localDB.sync(remoteDB,{live: true})

//I comment this line after 1st request
//localDB.put({ _id: '_design/foo', spatial: { bar: function (doc) { if(doc.type=='item') emit(doc.geometry); }.toString() } })   

localDB.post({geometry: { type: "Point", coordinates: [20.8215207, -102.76524380000001] },type:'item'}).then(function () {
  console.log('put point');
  return localDB.spatial( 'foo/bar', [ 20, -103, 21, -102 ]);
}).then(function (resp) {
  console.log('query 1');
  console.log(resp);
  return localDB.spatial( 'foo/bar', [ 20, -103, 21, -102 ])
}).then(function (resp) {
  console.log('query 2');
  console.log(resp);
}).catch(function(err) {
  console.log('err')
  console.log(err)
});

It works well in a browser let say chrome, but if i try on other browser opera it returns image

I'm working with ionic framework, so it also fails on the device.