inProgress-team / inProgress-team/react-native-meteor

[REQUEST] Be able to have local only collection

Open
#341 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
688
Forks
200
PR merge metrics
No merged PRs in 30d

Description

I have a case where I want to keep some data locally and it is much easier for various reasons if it is a mongo collection from Meteor, I do this on web with meteor so it should be easily possible to do it with this package.

On web when you create a new mongo collection
`new Mongo.Collection(null, {connection: null})
`
Either passing no name, or passing 'connection:null' will result in it being a local only collection.

Right now if you were to make this collection all the items get removed after a short time out due to trying to insert it in a server collection.

My suggested change is to check mark it as a local connection in the case where you don't pass a name, and then skip the ddp calls in the insert/update/remove functions.

Temporary workaround I found is I can call:
`myCollection._collection.upsert({_id: data._id}, {$set:data})
`
Which skips all the ddp logic.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.