Giter Club home page Giter Club logo

Comments (8)

Frizlab avatar Frizlab commented on July 28, 2024

Hello. In theory BSONSerialization should be able to decode multiple documents in the stream, but you’ll have to call bsonObject(with:) for each document to decode, each time passing the same stream.
Note I did not test this yet, so it might not work, but it should.

from bsonserialization.

adhigadu avatar adhigadu commented on July 28, 2024

thanks @Frizlab , I will test this and see..

from bsonserialization.

adhigadu avatar adhigadu commented on July 28, 2024

hi @Frizlab i have tried passing the same stream and its not working. after passing for the first time it skipped the rest of the stream and failed to parse ..

from bsonserialization.

Frizlab avatar Frizlab commented on July 28, 2024

I have reproduced the issue. Will release a fix ASAP.

from bsonserialization.

adhigadu avatar adhigadu commented on July 28, 2024

thanks @Frizlab appreciate it..

from bsonserialization.

Frizlab avatar Frizlab commented on July 28, 2024

The bug should be fixed in 2.1.3.
Don’t hesitate to re-open the issue if it is not 🙃

from bsonserialization.

adhigadu avatar adhigadu commented on July 28, 2024

thanks @Frizlab will test and let you know..

from bsonserialization.

adhigadu avatar adhigadu commented on July 28, 2024

@Frizlab I have tried this logic and tried

func searaliseBsonStream() {
      let request = self.getRequest()
        Alamofire.request(request as URLRequestConvertible).stream { (response) -> Void in
            print(response)
            let inputStream = InputStream(data: response)
        do {
            inputStream.open()
            while inputStream.hasBytesAvailable { 
                let data = try BSONSerialization.bsonObject(with: inputStream)
                print(data)
               }
            }
        }
     }

It works for some time and then throwing the following error
noMoreData
16384 bytes
invalidElementType(114)
16384 bytes
invalidElementType(54)
8768 bytes
invalidElementType(116)
3992 bytes
invalidElementType(115)

However if i put a debugger inside the bsonObject function and run the code, its reading more documents and throwing less errors.

I wonder if there is a thread issue or something.. Appreicate your help.. We been stuck on this for a while now and not sure what to do?

from bsonserialization.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.