Home > Article > Backend Development > MongoDBDriverCursor gets result set in associative array form?
During the upgrade process of php7, since the old mongo.so extension is no longer supported, we have no choice but to use mongodb.so. The cursor objects between the two are very different. The old version of the cursor object returns an _id as the key after iteraor_to_array. Associative array, can the new version only return a numerical index array? Is there any way to solve it?
During the upgrade process of php7, since the old mongo.so extension is no longer supported, we have no choice but to use mongodb.so. The cursor objects between the two are very different. The old version of the cursor object returns an _id as the key after iteraor_to_array. Associative array, can the new version only return a numerical index array? Is there any way to solve it?
When using the MongoDBDriverBulkWrite()
class to perform an insert
operation, an object with oid=uniq_random_words
will be returned. This should be its key, right? When performing a query operation, the queried data will also come out with the field
oid. This can be used as the key in the associative array you mentioned, right? ? I'm also learning mongodb, sorry if you verify that this is not what I said