[CDRIVER-1968] Does the 1.5.0 support views? Created: 28/Dec/16  Updated: 11/Sep/19  Resolved: 29/Dec/16

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: 1.5.0
Fix Version/s: None

Type: Task Priority: Critical - P2
Reporter: chang Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

windows



 Description   

Hi,
I used mongoc_collection_find_with_opts() to retrieve on a view with opts sort:{$natural:1} and got error message:
"Error from MongoDB Client: FieldPath field names may not start with '$'. (Error Code: 16410)"
Meanwhile, the same call on a real collection can be handled well.

I searched the source code and release notes using key word "view" and browse the api reference, but still have no clue how well the view gets supported.
I would appreciate if you could please give me some info about it.
At least, is there a way to distinguish if a collection is a view through c driver?

Thank you



 Comments   
Comment by Hannes Magnusson [ 29/Dec/16 ]

Yes, the 1.5.0 release does support view. There is actually not anything for a driver to support for in terms of using views, they are represented as collection so there isn't anything special we need to do to use them – however, creating them requires creating a special collection.

Unfortunately, views have some limitation, such as not supporting $natural at the moment.

See https://docs.mongodb.com/manual/core/views/#reference-views for further details

Generated at Wed Feb 07 21:13:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.