Esempio n. 1
0
        public bool FindDocument(string name, string colname, out JSONDocument doc)
        {
            bool found = false;
            IList <IJSONDocument> jsonDocuments = new List <IJSONDocument>();

            doc = new JSONDocument();

            if (name != null)
            {
                doc.Key = name.ToLower();
                jsonDocuments.Add(doc);
                IGetOperation getOperation = new GetDocumentsOperation();
                getOperation.Database    = MiscUtil.SYSTEM_DATABASE;
                getOperation.Collection  = colname;
                getOperation.DocumentIds = jsonDocuments;
                IGetResponse response  = _store.GetDocuments(getOperation);
                IDataChunk   dataChunk = response.DataChunk;
                if (dataChunk.Documents.Count != 0)
                {
                    doc   = dataChunk.Documents[0] as JSONDocument;
                    found = true;
                }
                else
                {
                    doc   = null;
                    found = false;
                }
            }
            return(found);
        }