Skip to content

Conversation

@domharrington
Copy link
Contributor

Without this, the API between memory-backed services have a
different API to save-mongodb services, which can cause test
failures.

Without this, the API between memory-backed services have a
different API to `save-mongodb` services, which can cause test
failures.
@serby
Copy link
Owner

serby commented Feb 24, 2015

What cases do you still need idType()?

@domharrington
Copy link
Contributor Author

article-slug-listener performs a read on the service by firstly casting the _id. This works with a save-mongodb persistence, but not a memory engine.

@serby
Copy link
Owner

serby commented Feb 24, 2015

I don't think it is needed in that case.

@serby
Copy link
Owner

serby commented Feb 24, 2015

I was hoping to deprecate idType() but I'm unsure if there are still any valid use-cases

@domharrington
Copy link
Contributor Author

The tests do appear to pass without the call to service.idType(). Maybe it isn't needed...

It looks as though castIdProperty is called on read which caters for that case: https://github.com/serby/save-mongodb/blob/master/lib/mongodb-engine.js#L95

The only other use case I can think is:

var ids = _.map([1, 2, 3], function (id) {
  return service.idType(id)
})

var query = { _id: { $in: ids } }

Would this be catered for?

@serby
Copy link
Owner

serby commented Feb 24, 2015

@domharrington
Copy link
Contributor Author

In which case, i dont think this is needed and idType() can be removed from save-mongodb as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants