Elfocrash / Cosmonaut

🌐 A supercharged Azure CosmosDB .NET SDK with ORM support
https://cosmonaut.readthedocs.io
MIT License
342 stars 44 forks source link

Dynamic documents #13

Closed leonpotgieter closed 6 years ago

leonpotgieter commented 6 years ago

Hi Nick, Understand that Cosmonaut is an object mapper, but wondering if there is a simple way to query for and return dynamic documents... I have imported many JSON docs in bulk which vary in terms of structure, would be great to be able to return a dynamic.

Elfocrash commented 6 years ago

Hello @leonpotgieter. You actually can do that but only with the SQL methods.

QuerySingleAsync and QueryMultipleAsync both have a generic type T alternative that allow you to specify you object. Keep in mind that this applies the collection sharing rules.

Let me know if that makes sense and if it works for you.

Edit: I also have the lower level DocumentClient exposed in case you want to do something manually. The Async extension method will work with any CreateDocumentQuery.

Elfocrash commented 6 years ago

Closing this due to inactivity. Feel free to reopen if you need to ask anything else.