senecajs / seneca-entity

Entity plugin for seneca
MIT License
13 stars 15 forks source link

make() stores id property. What is id$ for? #26

Open indr opened 8 years ago

indr commented 8 years ago

I was wondering about this id$ property. Added two tests to test/entity.jsL#70. They pass.

si.make('zed').data$({id$: 2, z: 2}).save$(function (e, z) {
  assert.equal(2, z.id)
  assert.equal(2, z.z)

  si.make('zed').data$({id: 3, z: 3}).save$(function (e, z) {
    assert.equal(3, z.id) // <--- ???
    assert.equal(3, z.z)

    si.make('zed').data$({z: 4}).save$(function (e, z) {
      assert.equal(6, z.id.length) // ex.: z.id === 'vkipt3'
      assert.equal(4, z.z)

      si.close(done)
    })
  })
})

Why is id: 3 saved? Isn't the property id$ designed to provide a client side id? What am I missing?

mcdonnelldean commented 8 years ago

Smells like a bug, although there may be more to this around particular databases. @mihaidma Want to weigh in on this?