[CSHARP-1800] How to get the view data? Created: 17/Oct/16  Updated: 03/Dec/20  Resolved: 03/Dec/20

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

Type: Task Priority: Major - P3
Reporter: Hu Assignee: Unassigned
Resolution: Done Votes: 0
Labels: question
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I create a view,and the view is detected as a collection.
I can know if a collection is a real collection or a view by reference the system.views collection.
But when I use FindAllAs<BsonDocument>() to get the data,nothing returned.
I want to know how to get the data of a view.Thank you.



 Comments   
Comment by Hu [ 17/Oct/16 ]

Is there a flag or property that tell me a collection is a collection or a view directly?

Comment by Hu [ 17/Oct/16 ]

Sorry,FindAllAs does work by query the view create by the driver.
But It does not work when run the example :
db.createView(
"managementFeedback",
"survey",
[ { $project:

{ "management": "$feedback.management", department: 1 }

} ]
)

//department: 1 is convert to 1.0 by mongo shell???

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