Imports MongoDB.Bson
Imports MongoDB.Driver
Imports MongoDB.Driver.Builders
Public Class frmMongoDB
Sub MongoDB()
Dim client As MongoClient
Dim server As MongoServer
Dim db As MongoDatabase
Dim col1 As MongoCollection
client = New MongoClient("mongodb://localhost")
server = client.GetServer()
db = server.GetDatabase("db1")
col1 = db.GetCollection("table1")
Dim query = New QueryDocument("textbox1.text")
End Sub
col1.Find(Of IEnumerable)(Query.EQ("first_name", "james))
'or
col1.Find(Of IEnumerable)(query) 'based on your example variable
for each var_user in col1.Find(Of IEnumerable)(query)
'code here
nextOk..thanks. How can I check if its working. Can I use delete or drop a collection the same way ?
Thanks I was able to solve a lot of issues. However I'm still facing issues with querydocument.. The statement format is totally different .. I am not able to run queries like select a from table where b =1
I know the corresponding nosql but how do I write it in query document. It seems to be accepting only format like b,1 where it finds all elements of the document with table1
Is there a way to take ANY query from text box and run it ? If not just help me with the above issue.
Thanks in advance again