Comments (10)
@Joannis Thanks for the quick response. 👍🏼
I hope it's not too much of an effort.
from fluent-mongo-driver.
I'll close this for now, feel free to reopen off you have any more queries!
from fluent-mongo-driver.
cc @Joannis
from fluent-mongo-driver.
Hey @thedan84, I haven't tried connecting to CosmosDB, and wouldn't know what's different about their connection phase. I'm creating an azure account so that I can dive into the issue.
from fluent-mongo-driver.
Hey @thedan84 , I seem to have found the cause of the issue. CosmosDB is violating the handshake specification, by providing an epoch timestamp rather than a BSON timestamp. I'm currently debating in what way to support this violation without affecting other code behaviour (too much).
from fluent-mongo-driver.
It's a bit more complicated than just one spec violation. I'll try to see what all the differences are.
from fluent-mongo-driver.
Hey @thedan84, I've found CosmosDB to be at the least a major pain in the ass, but I can send queries now.
A couple notes, for the interested (or people that for some insane reason want their own MongoDB+CosmosDB driver):
- CosmosDB does not support OpMessage, even though it's supported API level indicates it does. If you for some "foolish" reason expect to use OpMessage, you're greeted by the amazing concept of "let's just close the connection without an error".
- CosmosDB' MongoDB API is basically just a proxy to HTTP, and the errors are just as nice as you'd expect - an HTTP message dumped into the
errmsg
string. - While it's clearly documented in the BSON spec, cosmos DB expects you to read
Date
as an epoch timestamp, even toughDate
is the formal definition by spec of these values. This is particularly noticeable in theisMaster
handshake. So drivers just need to deal with the spec violation. - Even though MongoDB and SASL spec both state you can send "String", "Binary representing UTF-8 of a String" or "Binary representing the base64-ed value of the UTF-8". CosmosDB only accepts the second one. Any attempts at base64-ed data, or regular String data, is met by a confusing error.
Once all of these are resolved, I can do inserts and find ops. But don't expect the powerful MongoDB features such as aggregates to work fully as expected.
from fluent-mongo-driver.
If you're on discord, please contact me :)
from fluent-mongo-driver.
Hey @thedan84 , I happened to get an email this morning regarding the future of MongoDB for drivers. They're making some big changes, the most critical of which is the deprecation of their old protocol. That protocol has already been replaced in MongoDB 3.6, dating back to 2017.
Unfortunately for you, CosmosDB is quite heavily reliant on that old protocol right now. It uses OP_QUERY rather than OP_MESSAGE, as mentioned in my previous comment. That implies that MongoKitten will need to run in a customised legacy mode for CosmosDB to work. While I currently have a branch targeting CosmosDB, it's highly unlikely that I'll implement such code it in the official releases.
On the upside:
- CosmosDB has an HTTP API
- You can build a custom client that supports CosmosDB using
MongoKittenCore
, which will still maintain the necessary legacy protocol specification.
from fluent-mongo-driver.
@Joannis Thanks for the update. I'll see what I'll do then. Maybe I just use the official driver for work then. I got it working with that, but wasn't overly happy with the result. Thanks anyway for investigating and all the updates.
from fluent-mongo-driver.
Related Issues (9)
- Issue in Xcode when adding swift dependency for fluent-mongo-driver HOT 3
- Cannot build or test
- Add helpers for migrating MongoDB datasets to add new required fields
- Add support for MongoDB $text indexes
- MongoDB driver taking extremely long to query HOT 7
- Fix CI HOT 1
- FluentMongoError is not public
- TTL index HOT 1
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 fluent-mongo-driver.