Comments (8)
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.
thanks @Frizlab , I will test this and see..
from bsonserialization.
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.
I have reproduced the issue. Will release a fix ASAP.
from bsonserialization.
thanks @Frizlab appreciate it..
from bsonserialization.
The bug should be fixed in 2.1.3.
Don’t hesitate to re-open the issue if it is not 🙃
from bsonserialization.
thanks @Frizlab will test and let you know..
from bsonserialization.
@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)
- Inputstream failing HOT 2
- Issue with JSONSerialization HOT 2
- Further development ? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bsonserialization.