Zoclee / xojo-mongodb

MongoDB driver for Xojo.
15 stars 5 forks source link

Collection.createIndex(keys, options) #5

Closed alwyn1024 closed 10 years ago

alwyn1024 commented 10 years ago

Add method createIndex() to Collection class, so that indexes can be created on collections.

ghost commented 10 years ago

Creating indexes is certainly a requirement but this is probably not enough:

db.collection.ensureIndex( { 'key': 1 } ); to create an index db.collection.getIndexes(); to find them all db.collection.dropIndex( { 'key' : 1 } ); to remove an index

alwyn1024 commented 10 years ago

Absolutely, I've created individual feature requests for each method in the list.

Already looked into how to create indexes, and it seems easy enough. Will commit the new driver feature as soon as I've implemented it.

ghost commented 10 years ago

db.system.indexes.find() already works even in test app when you set collection to system.indexes

On 12 Nov 2013, at 10:43 , Alwyn Bester notifications@github.com wrote:

Absolutely, I've created individual feature requests for each method.

Already looked into how to create indexes, and it seems easy enough. Will commit the new driver feature as soon as I've implemented it.

— Reply to this email directly or view it on GitHub.


https://nodeleaf.net

alwyn1024 commented 10 years ago

Yeah, you could probably do all your index management by running queries directly on system.indexes, but it still would be nice to have proper index methods to make things easier for noobs.

alwyn1024 commented 10 years ago

First version of db.collection.createIndex(keys, options) implemented.

The following still need to be completed:

  1. Currently keys need to be given in well-formed JSON (e.g. {mykey:1} will cause an error).
  2. options is currently ignored.

Will work on these two issues next.

alwyn1024 commented 10 years ago

CreateIndex now fully implemented.