Meteor-Community-Packages / Meteor-Community-Packages/ground-db

ok to use Mongos ObjectID?

Open
#82 4 comments 0 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
JavaScript
Stars
569
Forks
77
PR merge metrics
No merged PRs in 30d

Description

This could be my app but when creating documents with Mongos ObjectID they will not be retrieved next time the app is started in offline mode.

``` javascript
lists.insert({'_id':new Mongo.Collection.ObjectID(),'name':name});
```

This doesn't seem to be an issue when not specifying the id:

``` javascript
lists.insert({'name':name})
```

In both cases Local storage saves the doc ids as strings, for ObjectID an extra element called _str is added. Maybe I shouldn't be using Mongo IDs in my Meteor apps?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the two lists.insert examples, then inspect how Mongo.Collection.ObjectID values are serialized into local storage and restored after an offline restart. Done means documents created with an ObjectID are retrieved across restarts, while documents without an explicit id continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.