Delete record field via deepstream Record

时间:2016-04-07 10:40:28

标签: deepstream.io

I'm looking for a way to clean document nested field, for example, consider I have a JSON object:

{
  fieldToClean: {
    fieldA: '..',
    fieldB: '..',
    fieldC: '..'
  }
}

I know that I don't need fieldB anymore. I found one solution that looks like:

var record = deepstream.record.getRecord('<proper path>')
record.whenReady(function(){
  var fieldToClean = record.get('fieldToClean')
  delete fieldToClean.fieldB
  record.set('fieldToClean', fieldToClean)
})

I wonder if deepstream provides something like:

record.delete('fieldToClean.fieldB')

or

record.set('fieldToClean.fieldB', undefined)

I wasn't able to find something like this in documentation.

Thank you for your time!

1 个答案:

答案 0 :(得分:1)

这个开放实际上是一个问题,我们的主要设计问题是删除数组中的索引。这是空的还是拼接?很高兴得到您的反馈!

https://github.com/deepstreamIO/deepstream.io/issues/29