Comments (5)
Does DRAFTS.findOne('58d887874e0ca825443236cf')
work as expected?
from ground-db.
No, it behaves the same way that {_id:"58d887874e0ca825443236cf"} is. If the id is not 24 characters, then it works as expected. It's only when there are 24 characters where it fails.
from ground-db.
The problem is in the MongoID package, idStringify added '-' before the id when fetching the document. LINE 64
MongoID.idStringify = function (id) { // 56
if (id instanceof MongoID.ObjectID) { // 57
return id.valueOf(); // 58
} else if (typeof id === 'string') { // 59
if (id === "") { // 60
return id; // 61
} else if (id.substr(0, 1) === "-" || // escape previously dashed strings // 62
id.substr(0, 1) === "~" || // escape escaped numbers, true, false // 63
MongoID._looksLikeObjectID(id) || // escape object-id-form strings // 64
id.substr(0, 1) === '{') { // escape object-form strings, for maybe implementing later
return "-" + id; // 66
} else { // 67
return id; // other strings go through unchanged. // 68
} // 69
} else if (id === undefined) { // 70
return '-'; // 71
} else if (typeof id === 'object' && id !== null) { // 72
throw new Error("Meteor does not currently support objects other than ObjectID as ids"); // 73
} else { // Numbers, true, false, null // 74
return "~" + JSON.stringify(id); // 75
} // 76
};
Meteor Minimongo works fine since it stores the ids with '-' prefix, but not for ground db.
from ground-db.
It seems we should not use the custom strid, we should use MongoID.idStringify instead.
https://github.com/GroundMeteor/db/blob/grounddb-caching-2016/lib/client/ground.db.js#L40
from ground-db.
@Chun-Yang did you ever find a solution for this issue? We encounter the same with id's generated by:
new Meteor.Collection.ObjectID()._str
for example an ID:
8298e2f637a1a4b9e114abe8
24 characters it is.
If the issue is not resolvable it would be good to throw an error when an unrecognized ID type is sent into find() and findOne() methods. That way you understand as a developer that this is an ID issue and not a synchronization / data issue.
from ground-db.
Related Issues (20)
- Ionic2/Angular2 support? HOT 4
- Auto cleanup as data grows HOT 2
- React native support HOT 1
- wait for all inserts done HOT 1
- Status of package HOT 6
- GroundDB on Meteor Unable to handle file size >= 5MB HOT 4
- Unclear on how to use version 2 HOT 2
- Using pendingReads & pendingWrites HOT 1
- .observeSource is not a function HOT 3
- groundDB: how to add another database?
- Sometimes getting back undefined HOT 1
- Can't get reactive vars
- GroundDB with Meteor + PostgresSQL HOT 2
- Updating Grounded Collection + syncing with server
- loadDatabase not working
- Remove is inconsistent HOT 2
- Moving to Meteor Community HOT 17
- GroundDB doesn't sync data to live server when getting online again after a while HOT 2
- ReferenceError: EventState is not defined HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ground-db.